Mega Code Archive

 
Categories / C# / Language Basics
 

Illustrates the use of an if statement that executes a block

/* Mastering Visual C# .NET by Jason Price, Mike Gunderloy Publisher: Sybex; ISBN: 0782129110 */ /*   Example4_2.cs illustrates the use of an if statement   that executes a block */ public class Example4_2 {   public static void Main()   {     int smallNumber = 5;     int bigNumber = 100;     if (bigNumber < smallNumber)     {       System.Console.Write(bigNumber);       System.Console.Write(" is less than ");       System.Console.Write(smallNumber);     }     else     {       System.Console.Write(smallNumber);       System.Console.Write(" is less than ");       System.Console.Write(bigNumber);     }   } }