Bool Type:
- Bool is a data type which is to represent the true or false value in C#.
- The Bool type variables or expressions will be true or false.
- Unlike other programming Languauges, there is no conversion between the bool and integers in C#.
Program using bool type
using system;
class exbool
{
public static void Main()
{
bool b;
b= false;
Console.WriteLine("b is"+ false);
b = true;
Console.WriteLine("b is "+ true);
if(b)
{
Console.WriteLine("It is executed");
}
b= false;
if(b)
{
Console.WriteLine("It is not executed")
}
Console.WriteLine("100>99 is"+(100>99))
}
}
Output:
b is false
b is true
It is executed
100>99 is true
0 comments for this post