0

Why each case is evaluated if we ommit break even if variable is not matched?

17th Sep 2019, 4:52 PM
Vinay Rajpoot
2 Answers
+ 3
Why... I can't answer that. It is called fall-through: If there's no break, execution drops to the next case. You can use it to bind several cases together as one. case 1: case 3: case 5: // Now the code for these three.
17th Sep 2019, 5:21 PM
HonFu
HonFu - avatar
+ 3
to have two cases with the same statements without repeat it case 1: //do1 case 2: //do1 case 1: case 2: //do1
17th Sep 2019, 5:35 PM
ABADA S
ABADA S - avatar