Objective-C switch statement inside a loop
Since the switch
statement has break
, and usually we use break
to stop the looping process. In my mind break
& continue
are like brother, usually use inside a loop.
I wonder what if continue
inside the switch
statement. So I try it out
1 | for (int i = 0; i < 10; i++) { |
and I get this output
1 | this is 0 |
So you can see here, the continue
skip the loop by 1 turn; where as break
has totally no effect to the loop, but to switch
only