C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers


10,705 users

What does a break statement do in the switch statement?

0 votes
asked by john Guru (27,140 points)

1 Answer

0 votes


The switch statement is a selection control statement that is used to handle multiple choices and transfer control to the case statements within its body. The following code snippet shows an example of the use of the switch statement in C#: 
 case 1:
 case 2:
 console.WriteLine("Wrong choice");
In switch statements, the break statement is used at the end of a case statement. The break statement is mandatory in C# and it avoids the fall through of one case statement to another.
answered by keem Expert (13,240 points)

Related questions

0 votes
1 answer 37 views
37 views asked by john Guru (27,140 points)
0 votes
1 answer 60 views
0 votes
1 answer 1,142 views
+1 vote
1 answer 50 views
0 votes
1 answer 1,393 views