By 22/07/2015 17 Comments

C# if then if-if Statements

  • This form of if statement is useful when you let users to select more than one or multiple choices at a time depends on condition.
  • There is no else is used, but you can use it at the end of if statements and else statement is an optional statement.
  • This ifs form is very useful for input forms validation.
  • In this form, all if statements will be executed at a time if they become true, and bypassed those which become false.


using System;
namespace csharpBasic
    // Start class definition / declaration.
    class Program
        // Static main method void type declaration.
        static void Main(string[] args)
            // Initialize an int value
            int value = 10;

            if (value == 10)
                Console.WriteLine("It is 10.");

            if (value * 5 == 10)
                Console.WriteLine("It is 50.");

            if (value / 2 != 10)
                Console.WriteLine("It is also 10.");

            if (value < 11)
                Console.WriteLine("It is less than 11 because it is 10.");


        } // End of main method definition. 
    } // End of class. 

   The Output will be:
   It is 10.
   It is also 10.
   It is less than 11 because it is 10. 

Next Tutorial →

← Previous Tutorial

Posted in: C# Basics, C#.NET

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .