/*
C#: The Complete Reference
by Herbert Schildt
Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Demonstrate the if.
using System;
public class IfDemo {
public static void Main() {
int a, b, c;
a = 2;
b = 3;
if(a < b) Console.WriteLine("a is less than b");
// this won't display anything
if(a == b) Console.WriteLine("you won't see this");
Console.WriteLine();
c = a - b; // c contains -1
Console.WriteLine("c contains -1");
if(c >= 0) Console.WriteLine("c is non-negative");
if(c < 0) Console.WriteLine("c is negative");
Console.WriteLine();
c = b - a; // c now contains 1
Console.WriteLine("c contains 1");
if(c >= 0) Console.WriteLine("c is non-negative");
if(c < 0) Console.WriteLine("c is negative");
}
}