Viewing a single comment thread. View all comments

[deleted] t1_iyathy7 wrote

GOTO is considered an anti-pattern because it introduces non-linear control flow into a computer program - computer programs are generally written with linear control flow.

GOTO allows you to jump to any location in your program without any respect for how you got there - it's basically one-way teleportation.

Being able to teleport anywhere without respect for the structure of a given computer program allows you to do virtually anything regardless of how you got there, and, this leads to people doing a lot of weird things just because they can.

This is really the only reason why its use is considered an anti-pattern, and there's nothing wrong with using GOTO if you really know what you're doing.

Generally speaking you should stick with established well-known control flow semantics to make your program as easy to read as you can.

3