inc / dec (increment / decrement)

Navigation:  Macros > Macro Language > Operators >

inc / dec (increment / decrement)

Previous pageReturn to chapter overviewNext page

The inc operator takes an integer variable and increases it by one. The dec operator takes an integer variable and decreases its value by one. These operators are often used in a while loop.


// a very very inefficient method to calculate

// the number of days left in the current month

nDayLeftInMonth = 0

while MonthOf(Today() + nDayLeftInMonth) = MonthOf(Today())



sRESULT = 'Days left = ' + IntToStr(nDayLeftInMonth)


Some important points to note about these 2 operators. They do not return a value that is assigned to another variable; they operate directly on the variable.


inc(231) // incorrect !!!

inc(nDate + 12) // incorrect !!!


Because of this, you can only use these operators on integer variables, not on expressions as is the case with most other operators.

Topic 135200 updated on 17-Mar-2001.
Topic URL: