Open main menu

Wikibooks β

Visual Basic .NET/Binary operators

< Visual Basic .NET

VB.Net has several Binary Operators like '=', '<', '>', '<=', '>=' and '!=' which can be used in comparisons that evaluate to a boolean value. More complex expressions could be formed by using the binary operators with logical operators like 'AND', 'OR', 'NOT' and 'XOR'.

Example: The following example shows a code snippet to compare two variables and output the result in the Console Window

'Variables for comparison
Dim Value1, Value2 as Integer
'Assign Values

'Compare the values and output which one is greater
If Value1>Value2 Then
  Console.WriteLine("Value1 is Greater Than Value2!")
  Console.WriteLine("Value2 is Greater Than Value1!")