Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0068 Conditional operators in C#

C# has the following conditional operators: Operator Meaning && and || or ! not The following demo shows how to use them: using System; class Program { static void Main(string[] args) { int i = 5; int j = 6; if (i == j) { Console.WriteLine("identical"); } else { Console.WriteLine("not identical"); } } } The output: not identical