3 ms·
Exceptions are forward gotos. A "while" loop with continue and break is backward goto. The only thing missing is break from nested while. Java has one, called b
by hamilyon2 5y ago
Exceptions are forward gotos. A "while" loop with continue and break is backward goto.
The only thing missing is break from nested while. Java has one, called break with label, one of more obscure features of language.
So, in a sense, python already does have goto.
- cute_boi 5y agoSo rust also has goto :)
- Spivak 5y agoAll control flow constructs in modern programming languages are about codifying the safe uses of goto and setjmp. For example defer and friends are goto cleanup; and yield and exceptions are setjmp.
- brundolf 5y agoSometimes a feature of a programming language is about making it really inconvenient to do something you shouldn't be doing