6.5.4 Variable incrementing and
decrementing
To increment and output the value of a variable as a number
use the syntax:
$++variableName
To first output and then increment
the value of a variable, use the syntax:
$variableName++
The value of a variable may also be
decremented by using “--“
in place of “++” in the
above examples. Note that if the variable value is not a number it will be
interpreted as 0 for the increment or decrement operation. For non-integer
values and numbers in scientific format, the operations add or subtract 1
without rounding, returning a float representation.
If you do not want the result output, you can add a string
translation to it to map all characters (or just all digits) to nothing. The
translator would normally be defined just once at the start of the outermost
generator, but we include it inline here for completeness:
to '%null' newline '* $' endto
$variableName++%null
More complex calculations with
variables can be done by using the
math..evaluate
clause.