Logical operators with an if statement

image_pdfimage_print

   

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

Publisher: Sybex;
ISBN: 0782129110
*/
/*
  Example4_4.cs illustrates the use of
  logical operators with an if statement
*/

public class Example4_4
{

  public static void Main()
  {

    int reactorTemp = 1500;
    string emergencyValve = "closed";

    if ((reactorTemp > 1000) && (emergencyValve == "closed"))
    {
      System.Console.WriteLine("Reactor meltdown in progress!");
    }

  }

}