Application of/switch case
Console.WriteLine ("1. Hamburger");
Console.WriteLine ("2. French fries");
Console.WriteLine ("3. Chicken nuggets");
Console.WriteLine ("4. Chicken Leg");
Console.WriteLine ("5. Chicken rice flower");
Console.Write ("Please enter your choice of item number:");
String a = Console.ReadLine ();
Switch (a)//in parentheses is the variable name that is judged
{
Case "1": The value behind the//case is used to determine that the variables in the brackets above are not equal
Console.WriteLine ("You have chosen a hamburger");
Break;//break Jump statement, jump out of the nearest curly brace
Case "2": a space-separated value between the//case and the value is followed by a colon
Console.WriteLine ("Your choice is French fries");
Break
Case "3":
Console.WriteLine ("You have selected chicken nuggets");
Break
Case "4":
Console.WriteLine ("Your choice is chicken leg");
Break
Case "5":
Console.WriteLine ("Your choice is chicken rice flower");
Break The last one also needs to jump out of curly braces
}
Branch statement (switch case)