Operator and syntax

Go increment and decrement statements

Increments or decrements an assignable numeric operand by one. These are statements, not expressions; prefix forms do not exist. Example output: '3'.

Formal Syntax & Structure

go syntaxgo
x++; x--

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  n := 4  n++  n--  n--  fmt.Println(n)}
Go Reference