Syntax:
integer_variable = Int( single_variable )
Command Availability:
Available on all microcontrollers.
Explanation:
The Int function truncates a floating-point (Single) value down to its integer part, discarding the fractional part (it does not round). The result is returned as an integer,
so it must fit within the integer variable range.
Example:
Dim singlevariable As Single
Dim integer_value As Integer
singlevariable = 7.85
integer_value = Int( singlevariable ) ' <<< the Int instruction
' integer_value now holds 7Key line: Int( singlevariable ) — drops the .85 fractional part of 7.85, leaving the integer value 7 (not rounded to 8).
See Also:
- Abs — related command in the same category
- RoundSingle — rounding to the nearest whole number instead of truncating

