|
I'm somewhat against the notion that having goto's in a script is a bad thing.
Generally speaking, most things that you can do with a goto, you can do with a loop, a function, or a subroutine. However, this is NOT always true. Sometimes, trying to get rid of your goto lines causes more problems. What comes to mind is when you need to exit a loop prior to some lines executing. In order to get around a goto to exit a loop, sometimes you must add additional conditions and comparisons. This can make the script MORE confusing rather than less confusing.
General rule:
Eliminate goto statements whenever possible to do so without increasing the complexity of the script.
Sure, this is a judgement call, but I would rather see a "GOTO" that makes sense than a funky loop that has weird conditions. Many of these "acceptable" uses of GOTO could be eliminated with statements like:
EXITFOR EXITDO EXITWHILE
Brian
|