Re: New switch/case idea
- Posted by jimcbrown (admin) Apr 06, 2009
- 1718 views
jeremy said...
I wonder, not changing it, because it would indeed be confusing, but giving a warning if a break is given inside of an if statement w/no label? It almost always means an error. In fact, it would always mean an error? Maybe it should be an error actually? When would it ever be a good thing?
Jeremy
break is still useful for getting out of nested if statements.
However, it is hard to see a use of break for a single if-statement.
Perhaps we could only allow break to break out of an if-statement if a label is used, otherwise it defaults to break out of the switch (and is an error if there is no label and no switch).
Still, I'm a bit leery about doing this.