I thought case statement is like if statement. So in my example, when i is 4 and it meets case 1, then case 1 is not going to be entered. Why am I wrong? Thanks.
Larry, don't you see your reasoning is faulty?
OK, so what does break do? What purpose does it serve if, by your reasoning, once a case condition is met, the switch is exited as soon as the next case condition is met? If that's your conclusion, then why not just remove the break statements from case 1, case 2, and case 3? It's just unnecessary typing, according to your conclusion.
The answer is as GCDEF mentioned -- break does mean something in a case statement, and that is to ensure that the condition doesn't "fall through" to the next case condition.