incr
Increment an integer variable.
Syntax
tcl
incr varName ?increment?Parameters
- varName: Name of the variable containing an integer
- increment: Amount to add (default: 1)
Description
Adds increment to the integer value stored in varName and stores the result back in the variable. The variable must exist and contain a valid integer. Returns the new value.
Examples
Basic increment
Output
Custom increment value
Output
Loop counter
Output
