top of page
Search

Swicth Case Example for C#

  • Admin
  • Jun 23, 2024
  • 1 min read

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

Коментарі

Оцінка: 0 з 5 зірок.
Ще немає оцінок

Додайте оцінку

© 2023

 
bottom of page