xFactorSchool.com
Python
JavaScript
How to Do Examples
C Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Compilers
C Compiler
C++ Compiler
C# Compiler
Java Compiler
Python Compiler
HTML Code Editor
CSS Code Editor
JavaScript Compiler
JavaScript Code Editor
Practice how to use switch statement in C#
C# Online Editor
Execute Code
More C# Sample Code
using System; namespace ExampleApp { class Program { static void Main(string[] args) { string dayName = DateTime.Today.DayOfWeek.ToString(); // Today's name switch (dayName.ToLower()) // Convert to lowercase to make the comparison case-insensitive { case "sunday": // If today is Sunday, this code will be executed Console.WriteLine("Today is " + dayName); break; case "monday": // If today is Monday, this code will be executed Console.WriteLine("Today is " + dayName); break; case "tuesday":// If today is Tuesday, this code will be executed Console.WriteLine("Today is " + dayName); break; case "wednesday": // If today is Wednesday, this code will be executed Console.WriteLine("Today is " + dayName); break; case "thursday": // If today is Thursday, this code will be executed Console.WriteLine("Today is " + dayName); break; case "friday": // If today is Friday, this code will be executed Console.WriteLine("Today is " + dayName); break; default: // Otherwise, this code will be executed Console.WriteLine("Today is Saturday" ); break; } } } }