Core Function Int
From Sputnik Wiki
Int( <expression> )
Contents |
Description
Returns the signed 32-bit integer (whole number) representation of an expression
Parameters
Expression
An expression to convert.
Return Value
Success: Returns the new number.
Failure: Returns 0.
Remarks
Example
$Number = 777.42; $newNumber = int( $Number ); println("Old number: $Number"); println("New number: $newNumber"); // Prints // Old number: 777.42 // New number: 777
Alternative method using casting :
$Number = 777.42; $newNumber = (int)$Number; println("Old number: $Number"); println("New number: $newNumber"); // Prints // Old number: 777.42 // New number: 777