Syncopation Software

DPL 9 Help

Integer Keyword (DPL Code)

Integer Keyword (DPL Code)

The DPL keyword integer can be used in the definition of constants, values, series, and arrays that must have integer values. Whenever DPL evaluates an expression that will be assigned to an integer variable, the expression result will be rounded to the nearest integer value.


integer value Years_Remaining = years * 1.83;
integer Years_Remaining = years * 1.83; // same as above
integer series index =
   from 2010: 1,
   from 2015 to 2020: 2.6 * factor;

For most purposes, the integer keyword and the @round function have the same effect; the integer keyword is just a convenience. For example, if you want all the values in an array to be integers, you can use the @round function in the definition of each array item, or you can define the array to be an integer array, and the rounding will be automatic.

If you have a variable that must be an integer and you are using the don't specification to remove lotteries from the sequence section, you must use the integer keyword in that value's definition.

Don't confuse the integer keyword with the @int function: the @int function truncates an expression value to the next lower integer; the integer keyword rounds an expression value to the nearest integer.

You cannot define the values associated with a chance, decision, or controlled event to be integers. The following code is incorrect:

//incorrect code
integer chance A.{3} = {.2, .3} = 1, 2, 3;

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

The Definition Section