Search This Blog

Friday, December 28, 2012

How many data types in C# (Bool type)


Bool type
Bool type in C# can be used to represent a boolean value. A bool type is binary in nature and takes only 2 values true or false.

// Example for boolean type

using System;

    class bool_type
    {
        public static void Main(string[] args)
        {
            bool switch_on = true;
            bool switch_off = false;

            Console.WriteLine("If switch is ON,it is: " + switch_on);
            Console.WriteLine("If switch is OFF,it is: " + switch_off);
         
        }
    }


 Output
  If switch is ON,it is:True
  If switch is OFF,it is:False
 


No comments :