top of page
Admin

Swicth Case Example for C#

This console application use switch&case for detecting the day type which represents the simple example for C#


Console.WriteLine("type a day name:");
string day = Console.ReadLine().ToLower();
switch (day)
{
    case "monday":
    case "tuesday":
    case "wednesday":
    case "thursday":
    case "friday":
        Console.WriteLine("{0} is weekday.", day); break;
    case "saturday":
    case "sunday":
        Console.WriteLine("{0} is weekend.", day); break;
    default:
        Console.WriteLine("type  a day name!"); break;
}
Console.ReadLine();

Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page