eBabel Blog

Make a website

70-536 exam: if-then-else condition

20 March 2010

The if-then-else condition is part of the C# Language Specification, and so is somehow a deeper part of C# than the core and system library dll files (mscorlib.dll & system.dll)

A very simple if-then-else condition based on user-input:

using System;

class SwitchTest
{
	static void Main()
	{
		do 
		{
			string n = Console.ReadLine();

			if (n == "a") 
			{ 
				Console.WriteLine("yes: a" ); 
			}
			else 
			{ 
				Console.WriteLine("no: not a"); 
			};

			Console.WriteLine();
		} 
		while (true); 
	}
}

If you liked this blog post, you may want to subscribe to my news feed in your RSS reader.