Question: Rewrite the following switch statement as a nested if statement using a series of else. . .if statements: string birdName; switch (birdName) { case Pelican:
Rewrite the following switch statement as a nested if statement using a series of else. . .if statements:
string birdName;
switch (birdName)
{
case "Pelican":
Console.WriteLine("Lives near water.");
break;
case "Cardinal":
Console.WriteLine("Beautiful in the snow.");
break;
case "Owl":
Console.WriteLine("Night creature.");
break;
case "Eagle":
Console.WriteLine("Keen vision");
break;
case "Flamingo":
Console.WriteLine("Pretty and pink.");
break;
default:
Console.WriteLine("Can fly.");
break;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
