IncDec statements
The “++” and “–” statements increment or decrement their operands by the untyped constant 1. As with an assignment, the operand must be addressable or a map index expression.
IncDecStmt = Expression ( “++” | “–” ) .
The following assignment statements are semantically equivalent:
| IncDec statement | Assignment |
|---|---|
| x++ | x += 1 |
| x– | x -= 1 |
Go 语言规范
关于 LearnKu