Skip to content

Integer

See Also: Type Conversion Functions, Integer, Number, Real, Round, String

Purpose

The Integer function returns a value of type Integer from an input of another type.

Return Type

Integer

Syntax

Integer({expression})

Where:

  • {expression} cannot be of type string (unless it contains a numeric value that can be converted to an integer).

What It Does

The Integer function converts the {expression} into an integer. It eliminates the fractional portion (digits to the right of the decimal point) from the value of an expression.

String sValue
Move "-8.3782" to sValue
Move (Integer(sValue)) to iTabulation

In this example, the value -8 is moved to the variable iTabulation.

The Integer function does not change the type of the {expression}. It only affects the numeric precision to which {expression} is converted.

Notes

  • When used inside an expression, Integer affects only the precision of its own expression, not that of the evaluation of the overall expression.

    Number nResult nMean
    Move (3.14 * Integer(nMean)) to nResult
    

    This example would output 3.14 times the integer of the value of the number variable nMean to the number variable nResult in the full precision of number variables.

  • Real and number values are converted to integer values by truncation of the decimal portion of the value. To round to integers, use the Round function.

  • Integers can be used as Boolean values. A value of 0 is Boolean false, and any other value, positive or negative, is true.