Mega Code Archive

 
Categories / C# / Data Types
 

Demonstrate bool values

/* C#: The Complete Reference  by Herbert Schildt  Publisher: Osborne/McGraw-Hill (March 8, 2002) ISBN: 0072134852 */ // Demonstrate bool values.    using System;    public class BoolDemo {    public static void Main() {      bool b;        b = false;      Console.WriteLine("b is " + b);      b = true;      Console.WriteLine("b is " + b);        // a bool value can control the if statement      if(b) Console.WriteLine("This is executed.");        b = false;      if(b) Console.WriteLine("This is not executed.");        // outcome of a relational operator is a bool value      Console.WriteLine("10 > 9 is " + (10 > 9));    }  }