Name
Int Function
Class
Microsoft.VisualBasic.Conversion
Syntax
Int(number)-
number Use: Required
Data Type: Any valid numeric data type
The number to be processed
Return Value
Returns a value of the data type passed to it
Description
Returns the integer portion of a number
Rules at a Glance
The fractional part of
numberis removed, and the resulting integer value is returned.Intdoes not roundnumberto the nearest whole number. For example,Int(100.9)returns 100.If
numberis negative,Intreturns the first negative integer less than or equal tonumber. For example,Int(-10.1)returns -11.
Programming Tips and Gotchas
IntandFixwork identically with positive numbers. However, for negative numbers,Fixreturns the first negative integer greater thannumber, while Int returns the first negative integer less thannumber. For example,Fix(-10.1)returns -10, whileInt(-10.1)returns -11.Don’t confuse the
Intfunction withCInt.CIntcasts the number passed to it as an Integer data type, whereasIntreturns the same data type that was passed to it.
See Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access