Visual Basic .NET/Binary operators

      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
      Value1=25
      Value2=35
       
      'Compare the values and output which one is greater
      If Value1>Value2 Then
        Console.WriteLine("Value1 is Greater Than Value2!")
      Else
        Console.WriteLine("Value2 is Greater Than Value1!")
      Endif
      
      Last modified on 14 March 2012, at 20:33