if statement

if statement has the following form


if (booleanExpression){
   statement block; // execute if booleanExpression is true
}else{
   statement block; // execute if booleanExpression is false

}

The following code prints out Here is the value if larger than 0.


using System;

class Program
{
    static void Main(string[] args)
    {
        int i = 3;

        if (i > 0)
        {
            Console.WriteLine("Here");
        }
    }
}

The output:


Here
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.