INC Variable
Increments a variable.
Variable can be any target of an assignment, but must be numeric.
It is the exact equivalent of
X = 7 INC X PRINT X
8
DIM A AS Float[3, 3] X = 2 Y = 1 A[X, Y] = PI INC A[X, Y] PRINT A[X, Y]
4.14159265359
Here is a longer example in the terminal modus of Gambas:
STATIC PUBLIC SUB Main() DIM x AS Float DIM y AS Float DIM pos AS Integer DIM neg AS Integer DIM nul AS Integer pos = 0 neg = 0 nul = 0 FOR x = 1 TO 100 y = Rnd(-5, 5) SELECT CASE Sgn(y) CASE 0 INC nul 'the same as nul = nul + 1 CASE 1 INC pos CASE -1 INC neg END SELECT NEXT PRINT nul,pos,neg END