incr
incr varName ?increment?
Adds increment (1 by default) to the integer in a variable, and gives the new value. It makes the variable with 0 first when it has no value.
Examples
A click on an example runs it in the shell of the page.
set n 5; incr n -2:3
Errors
set s abc; incr sgives the errorexpected integer but got "abc"
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.