2 ms·
If (failed) goto retry; Is much more elegant than a loop, or at least easier to read since you only need to really pay attention to the happy path.
by withinboredom 5y ago
If (failed) goto retry;
Is much more elegant than a loop, or at least easier to read since you only need to really pay attention to the happy path.
- framecowbird 5y agoBut you can also do that with recursion if failed: do_thing() This is covered in the Julia docs, where they argue recursion is more readable than goto https://sodocumentation.net/julia-lang/topic/5564/-goto-and--label#input-validation https://sodocumentation.net/julia-lang/topic/5564/-goto-and-...
- withinboredom 5y agoI guess that depends on if the language supports tail recursion and/or you're 100% sure it won't blow the stack. If you need to retry forever, without using any memory to do so, goto is perfect.