Hacker News new | ask | show | jobs
by rprospero 879 days ago
I had always heard that the "single exit" focus on "break" and "continue" was a misunderstanding. When wild GOTOs roamed the earth, with was common for a subroutine to end by jumping to a new part of the code, with the jump location being different depending on conditionals within the code. The "single exit" commandment was that a subroutine should always exit back into the routine that had called it. That makes it less an injunction against a function having early returns and more a rejection of continuation passing style.
1 comments

"Break" and "continue" have been (accurately) described as "structured goto". They are, at heart, goto. But they are constrained to operate in ways the make sense within the structured programming approach.