Int Function in VB.NET
What is the use if Integer Function in VB.NET?
Explanation
Int Function
Integer Function in VB.net 2008 is used to return the integer part of the given number. But if the
the given number is negative, it returns the negative number less than or equal to the given number.
Syntax:
Int(Number)
In the above syntax
Number specifies the number whose integer portion is to be returned.
Example:
Module Module1
Sub Main()
Console.WriteLine('Integer part of 2.27 is: '
& Int(2.27))
Console.WriteLine('Integer part of 0.23 is: '
& Int(0.23))
Console.WriteLine('Integer part of -1.2 is: '
& Int(-1.2))
Console.ReadLine()
End Sub
End Module
Result:
Integer part of 2.27 is: 2
Integer part of 0.23 is: 0
Integer part of -1.2 is: -2
In the above example the negative values integer part is rounded to next highest lowest negative integer.This is the difference between Fix and Int functions