Home   Cover Cover Cover Cover
 

switch statement

/csbook/solutions/06/A02.cs
using System;

class Test {
  
  static void Main(string[] arg) {
    string country, language = "unknown";
    country = arg.Length == 0 ? null : arg[0];
    if (country == null)
      Console.WriteLine("no country specified");
    else if (country == "England" || country == "USA")
      language = "English";
    else if (country == "Germany" || country == "Austria" || country == "Switzerland")
      language = "German";
    else
      Console.WriteLine("don�t know language of " + country);
    Console.WriteLine("The language in {0} is {1}", country, language);
  }
}