GOTO: Hell

From this thread I find today’s merriment (non-programmers should probably just skip this post):

dkrysak: Is there a way to go to a particular line within the flow of a script?

gnashley: Not a good idea to use GOTO in BASH. Try using a while statement instead, or use functions.

tunasashimi: Go HUG a tree or shag a dolphin or something. Computers WORK in “GOTO”s. Whiles, procedures and case structures are mental masturbation.

 

“Go HUG a tree or shag a dolphin” is now going to be my stock answer to any GOTO Nazi I meet. GOTOs are legitimate programming constructs. It’s just not a good idea to use them as your only programming constructs. A program of nothing but FOR-LOOPs would suck just as hard as a GOTOized program.

Advertisements
Both comments and trackbacks are currently closed.
%d bloggers like this: