What is the effect of absence of break in swtch case statement?
Answers
Answered by
6
Heya,
__________________
__________________
↔∴∴→The Break Staement causes the condition in switch statement to skip and reach up to the result .
Suppose ,we are making a program to give a number and output its respective month for 1 to january and 2 to Feb.
then ,
1. If we will insert 3 in INPUT the program will go up to 3rd statement and if it will get its correct condition it will directly go up to the Result without reading the entire conditions
2 . If we will not Break that one , the program will skip all the condition which do not have BREAK option.
"REFER TO ATTACHMENT FOR BETTER VIEW"
In switch satement in attachment if we will give 2 without BREAK there will will be shown MARCH in place of Feb.
_________________
_________________
ANKIT
__________________
__________________
↔∴∴→The Break Staement causes the condition in switch statement to skip and reach up to the result .
Suppose ,we are making a program to give a number and output its respective month for 1 to january and 2 to Feb.
then ,
1. If we will insert 3 in INPUT the program will go up to 3rd statement and if it will get its correct condition it will directly go up to the Result without reading the entire conditions
2 . If we will not Break that one , the program will skip all the condition which do not have BREAK option.
"REFER TO ATTACHMENT FOR BETTER VIEW"
In switch satement in attachment if we will give 2 without BREAK there will will be shown MARCH in place of Feb.
_________________
_________________
ANKIT
Attachments:
Swarup1998:
Nice ((:
Similar questions
CBSE BOARD X,
8 months ago
Math,
1 year ago