bool and if statement

In this chapter you will learn:

  1. if statement with bool variable

if statement with bool variable

using System;/*from jav a 2 s . c  o  m*/

public class MainClass {
  public static void Main( ) {
    bool boolValue1 = true;
    bool boolValue2 = false;


    if( boolValue1 ) 
      Console.WriteLine("You should see this");

    if( boolValue2 )
      Console.WriteLine("You should not see this");

    if( boolValue1 && !boolValue2 )
      Console.WriteLine("Will you see this?");

    if( boolValue1 ) {
      Console.WriteLine("Statement 1");
      Console.WriteLine("Statement 2");  
    }
  }
}

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Using ToString() to Convert to a string
  2. Convert boolean value to "Yes" or "No"
Home » C# Tutorial » bool, char
bool
bool and if statement
bool value to string
Parse string to bool value
char type
char escape sequence
char case
Compare char value
char min/max value
Is char a digit
Is char a letter
Is char a symbol
Is char a Separator
Is char white space
Convert to char
UTF-16 Character