Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Tutorial_Project_1.Tutorial_1_Examples
- {
- //String is used to hold any text value.
- //The case will check any of the string text values for the "Two" from the string j.
- //If the value that is in string j does not match any of the values in the cases then it will go
- //To the default value which displays "Value not found".
- class SwitchCase
- {
- static void Main()
- {
- string j = "Two";
- switch (j)
- {
- case "Zero":
- Console.WriteLine("Value is 0");
- break;
- case "One":
- Console.WriteLine("Value is 1");
- break;
- case "Two":
- Console.WriteLine("Value is 2");
- break;
- case "Three":
- Console.WriteLine("Value is 3");
- break;
- case "Four":
- Console.WriteLine("Value is 4");
- break;
- default:
- Console.WriteLine("Value not found");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement