Any normal use of goto can be replaced by an entirely equivalent loop control statement, possibly using labels when breaking out of multiple levels of loops.This is exactly why in some cases I prefer goto over loop control statements. A loop introduces a block. Variabled my()ed in the block don't live outside them - if they are needed after the block (or goto destination), you have to separate the my() and the first initialization. Which is something I prefer not to. Second, sometimes you encounter code that, if turned into nested loops instead of gotos, will be nested deeply. Which can lead to a narrow strip of code on the right hand side of the window.
Now, that doesn't mean I use goto lightly. But I may opt for a goto instead of loop control two or three times a year.
In reply to Re^4: GOTO or not GOTO
by JavaFan
in thread GOTO or not GOTO
by jflevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |