Break statement in switch case - Statements in switch case

Q.  Break statement in switch case
- Published on 19 Oct 15

a. prevents from fallthrough
b. causes an exit from innermost loop
c. both a and b
d. none

ANSWER: both a and b
Break statement is an important statement which alters the normal flow of a program. It helps in exiting the switch case block . It is frequently used to terminate the processing of a particular case within the switch statement. Control passes to the statement that follows the terminated statement.

It also prevents fallthrough which occurs in the absence of break in the switch case. Fallthrough is a situation that leads to execution of all the cases which is possible in absence of break statement

Post your comment / Share knowledge

Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)