Math.Sign Function in VB.NET

What is Math.Sign function in VB.NET?


Math.Sign Function

Math.Sign in VB.NET is a mathematical function which is used to return the sign of the specified number. The value returned is either '-1', '1' or '0'.


In the above syntax Number is the number whose sign is to be returned.

Module Module1
Sub Main()
Console.WriteLine('Sign of -6.1 is':: & Math.Sign(-6))
Console.WriteLine('Sign of 0 is':: & Math.Sign(0))
Console.WriteLine('Sign of 8.2 is':: & Math.Sign(8.2))
End Sub
End Module

Sign of -6.1 is:: -1
Sign of 0 is:: 0
Sign of 8.2 is:: 1

In the above example, the Math.Sign mathematical function is used to get the sign used by the number as '-1' for minus, '+1' for plus, '0' if the number is zero.

Visual Basic Tutorial

Ask Questions

Ask Question