Demonstrate bool values : bool : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » bool »

 

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)); 
  } 
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» bool