VBScript Int Function
Definition and Usage
The Int function can return the integer part of a specified number.
Comment:If the number parameter contains Null, it returns Null.
Tip:See Fix function. Int and Fix functions both remove the decimal part of the number parameter and return the result represented by an integer.
Difference between Int and Fix functions is that if the number parameter is negative, Int function returns the first negative integer less than or equal to number, while Fix function returns the first negative integer greater than or equal to number parameter. For example, Int converts -8.4 to -9, and Fix function converts -8.4 to -8.
Syntax
Int(number)
Parameter | Description |
---|---|
number | Required. A valid numeric expression. |
Instance
Example 1
document.write(Int(6.83227))
Output:
6
Example 2
document.write(Int(6.23443))
Output:
6
Example 3
document.write(Int(-6.13443))
Output:
-7
Example 4
document.write(Int(-6.93443))
Output:
-7