c# switch example
switch (iGender)
{
case 1:
LabelOne.Text = "Male";
break;
case 2:
LabelOne.Text = "Female";
break;
c# switch example
switch (iGender)
{
case 1:
LabelOne.Text = "Male";
break;
case 2:
LabelOne.Text = "Female";
break;
c# switch
using System;
namespace SwitchStatement
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please write a movie genre.");
string genre = Console.ReadLine();
switch (genre)
{
case "Drama":
Console.WriteLine("Citizen Kane");
break;
case "Comedy":
Console.WriteLine("Duck Soup");
break;
case "Adventure":
Console.WriteLine("King Kong");
break;
case "Horror":
Console.WriteLine("Psycho");
break;
case "Science Fiction":
Console.WriteLine("2001: A Space Odyssey");
break;
default:
Console.WriteLine("No movie found.");
break;
}
}
}
}
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;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us