Illustrates the use of the comparison operators : Operators : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Operators »

 

Illustrates the use of the comparison operators









    

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example3_3.cs illustrates the use of
  the comparison operators
*/

public class Example3_3
{

  public static void Main()
  {

    bool result;

    // false expressions
    result = 10 == 1;
    System.Console.WriteLine("10 == 1 is " + result);
    result = 10 < 1;
    System.Console.WriteLine("10 < 1 is " + result);
    result = 10 <= 1;
    System.Console.WriteLine("10 <= 1 is " + result);

    // true expressions
    result = 10 != 1;
    System.Console.WriteLine("10 != 1 is " + result);
    result = 10 > 1;
    System.Console.WriteLine("10 > 1 is " + result);
    result = 10 >= 1;
    System.Console.WriteLine("10 >= 1 is " + result);
    int intValue1 = 10;
    int intValue2 = 1;
    result = intValue1 != intValue2;
    System.Console.WriteLine("intValue1 != intValue2 is " + result);

  }

}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Operators