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;
}
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.