Answers for "switch case condition c#"

C#
0

c# switch

int randomNumber = rnd.Next(1, 2); //a int tat equals 1 or 2

      switch (randomNumber) //the number we check the value of
      {
          case 1:
              Console.WriteLine("randomNumber = 1!");
              break;
          case 2:
              Console.WriteLine("randomNumber = 2!");
              break;
          default:	//the deafult state happens when the other casas do not
              Console.WriteLine("something went wrong");
              break;
      }
Posted by: Guest on October-28-2020

Code answers related to "switch case condition c#"

C# Answers by Framework

Browse Popular Code Answers by Language