Hacker News new | past | comments | ask | show | jobs | submit login

Even then there was a better way to do it. E.g. C# copied the C switch/case/break also, but with a caveat that all branches had to terminate without falling through. So you have to put a break there (or a return, or a goto, or a throw - basically any statement for which the compiler knows the control flow won't get past it).

And in rare cases where you do want fallthrough, they added the ability to "goto case" from the body of one case label to another. Which is kinda nice, because it follows the original C design in treating case labels as, well, labels.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: