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":
WriteLine("Lives near water.");
break;
case "Cardinal":
WriteLine("Beautiful in the snow.");
break;
case "Owl":
WriteLine("Night creature.");
break;
case "Eagle":
WriteLine("Keen vision");
break;
case "Flamingo":
WriteLine("Pretty and pink.");
break;
default:
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
