Mega Code Archive

 
Categories / VB.Net / Data Types
 

Use the Sign(Integer) method to determine the sign of an Integer value and display it to the console

Class Sample    Public Shared Sub Main()       Dim xInt1 As Integer = -3       Console.WriteLine(xInt1)       Console.WriteLine(Test(Math.Sign(xInt1)))    End Sub     Public Shared Function Test([compare] As Integer) As [String]       If [compare] = 0 Then          Return "equal to"       ElseIf [compare] < 0 Then          Return "less than"       Else          Return "greater than"       End If    End Function End Class