[Home]GOTO

HomePage | Recent Changes | Preferences

GOTO: a statement found in computer languages, that instructs the compiler or the interpreter to jump the place that GOTO specifies. GOTO is found in BASIC, C/C++, Fortran and various assembly languages (where it is usually called BRA or JUMP and is often the only way of organizing program flow).

Unlike a function call, a GOTO does not demand any preparation and structurization of the code. Because of that, it is very easy to produce code that turns out to be inconsistent, incomplete and generally unmaintainable (see Spaghetti code). Because of that, as functional languages became more prominent in the 1970s and 1980s, numerous computer scientists and engineers came to the conclusion that good programs should always use the normal flow commands (loops?, if-then statements etc.) and not use GOTO at all. Others claim, however, that while GOTO is generally bad, there are some tasks that still do sometimes require the use of GOTO statements, such as exception handling.

One famous criticism of GOTO is the article by Edsger Dijkstra called Go to statement considered harmful (Communications of the ACM 11, 147-148. 1968)

See also Structured programming.


HomePage | Recent Changes | Preferences
This page is read-only | View other revisions
Last edited November 1, 2001 4:25 am by EdwardOConnor (diff)
Search: