C# Syntax Conditional Statements if...else

- Info:

- This tutorial shows how to use if conditional statements.

- Example:

- Create C# Console Application Test.cs.

 

Test.cs

using System;

class Test {

static void Main(string[] args) {

int i = 10;

if (i == 10) { Console.WriteLine("i is 10" ); }

else if (i == 11) { Console.WriteLine("i is 11" ); }

else { Console.WriteLine("No match found"); }

}

}