bool values in if statement : Boolean Data Type : Data Type C# Examples


C# Examples » Data Type » Boolean Data Type »

 

bool values in if statement









    
using  System;  
  
class  Example  {  
    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.");  
  
    }  
}
    
   
  
   



Output

b is False
b is True
This is executed.


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Boolean Data Type