Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > Int FunctionThis standard VB function returns the integer part of a number. SyntaxReturnsUsageFor positive numbers, Int removes the fractional part of the expression and returns the integer part only. For negative numbers, Int returns the largest integer less than or equal to the expression. For example, Int (6.2) returns 6; Int(-6.2) returns -7. The return type matches the type of the numeric expression. This includes variant expressions that return a result of the same vartype as input, except vartype 8 (string) returns as vartype 5 (double) and vartype 0 (empty) returns as vartype 3 (long). The effect of this function is the same as that of the Fix function, except in the handling of negative numbers. Thus: ExampleThis example uses Int to generate random numbers in the range between the ASCII values for lowercase a and z (97 and 122). The values are converted to letters and displayed as a string. Sub Button_Click See AlsoExp Function |
Siebel VB Language Reference |