I did have one teacher in college give one example of where a GOTO wasn’t completely awful… as a test in the beginning of a loop. The logic was something like this:
DO WHILE (forever condition)
(some housekeeping);
IF (some exit condition) THEN GO TO labelA;
(the rest of the loop)
END DO;
labelA:
Why he suggested that, vs. a simple DO WHILE (exit condition is false), I honestly don’t recall… it made sense at the time.
More modern languages (this was PL/1) have more explicit structures such as Java’s break or continue commands.
The most egregious use of GOTO I saw was when maintaining some old code at my first job.
GOTO labelA
....
....
IF somecondition THEN
statement
statement
GOTO labelB /* note that this is an unconditional statement, nothing below it in the IF will EVER execute */
statement
statement
labelA:
statement
statement
END IF;
statement
statement
statement
labelB:
statement
Yes - there are statements in the middle of the IF that would never get executed… except that some of them would get executed by branching INTO THE MIDDLE OF THE IF CLAUSE.
The ability to do shit like this is all it took to convince me that GOTOs were intrinsically STOOPID.