Answer: These both are the selection statements used to together to perform
switch operations. In other words,
switch is used to execute particular section (
case) of the statement.
Example,
string Name = "Krishna";
switch (Name)
{
case "Krishna": // This case will be executed...
...............;
break;
case "Vamshi":
...............;
break;
default:
...............;
break;
}
For every
case,
break should be used to terminate the execution and let it go to the next
case.
Asked In: Spotted While Learning |
Alert Moderator