4 ms·
> GOTO is a BREAK (could always be substituted for one), but a BREAK is not a GOTO. You wrote this backwards, but you seem to understand the relationship and t
by bdowling 4y ago
> GOTO is a BREAK (could always be substituted for one), but a BREAK is not a GOTO.
You wrote this backwards, but you seem to understand the relationship and that GOTO is more general. That is, every BREAK is a GOTO (because you can always substitute a GOTO), but every GOTO is not a BREAK (i.e., you can't substitute a BREAK for some GOTOs because BREAK cannot jump to an arbitrary label).
- lolinder 4y agoNo, I wrote it in exactly the order I wanted to. Because of the substitution property that you acknowledge, GOTO is a subtype of BREAK. BREAK is not a subtype of GOTO because it cannot always be substituted for GOTO. Thus, "GOTO is a BREAK, but a BREAK is not a GOTO." A GOTO is just one possible implementation of BREAK, just as a cat is one possible implementation of an animal. The practical impact of this is that it is incorrect to ascribe to BREAK the same weaknesses as GOTO, because BREAK is not a GOTO.
- strangattractor 4y agoThe moment I received a down vote for a simple opinion/observation about relieving naming overload and the similarities of BREAK and CONTINUE to GOTO I knew where this was going:)