0
Why each case is evaluated if we ommit break even if variable is not matched?
2 Respuestas
+ 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.
+ 3
to have two cases with the same statements without repeat it
case 1:
//do1
case 2:
//do1
case 1:
case 2:
//do1