DELAPARRA
Index
Color
NL
Category: Programming paradigms

GOTO

Explained by Updated

What is GOTO?

GOTO: An unconditional jump to an arbitrary label — the construct structured programming was designed to eliminate. GOTO jumps unconditionally to a labelled line elsewhere in the program. Early languages relied on it heavily, and programs often became tangled webs of jumps that were nearly impossible to follow. In 1968 Edsger Dijkstra wrote his famous letter "Go To Statement Considered Harmful". Structured programming replaced jumps with loops, conditionals and functions, which make the flow of a program visible in its structure.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about GOTO

What should you keep in mind with GOTO?

Some languages still have it. PHP has a limited goto, and C uses it in a few accepted patterns for error cleanup. In everyday code there is almost always a clearer option: an early return, a break or continue, or a well-named function. If you find yourself wanting to jump around, it usually means a function is doing too much and should be split.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with G

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.