If Else
/*
Learning C#
by Jesse Liberty
Publisher: O'Reilly
ISBN: 0596003765
*/
using System;
namespace Branching
{
public class TestIfElse
{
static void Main()
{
int valueOne = 10;
int valueTwo = 20;
Console.WriteLine("Testing valueOne against valueTwo...");
if ( valueOne > valueTwo )
{
Console.WriteLine(
"ValueOne: {0} larger than ValueTwo: {1}",
valueOne, valueTwo);
} // end if
else
{
Console.WriteLine(
"Nope, ValueOne: {0} is NOT larger than ValueTwo: {1}",
valueOne, valueTwo);
} // end else
} // end Main
} // end class
} // end namespace
Related examples in the same category