The GOTO Statement Content from the guide to life, the universe and everything

The GOTO Statement

13 Conversations

GOTO is a statement in some computer languages with which the order of execution of a program can be controlled. In short, GOTO tells the program to continue its execution not at the next statement as usual but at another statement.

The use of GOTO as a statement in programming languages such as BASIC, COBOL and others, has become a religious issue. Newbie programmers in the aforementioned languages are likely to use GOTO statements in large quantities, resulting in 'spaghetti' code that nobody, even the author, could ever follow or maintain. Computer scientists in general detest the use of GOTO; see Edsger W Dijkstra's 1968 note 'GOTO Statement Considered Harmful' (this note, among other publications, started the 'structured programming' holy wars).

It must be stated, however, that the GOTO statement is at times very useful to get around the lack of a better structure in the language, for certain types of loops for instance, and could also be essential for error trapping.

Amusingly, program code completely without GOTOs, sufficient size and complexity provided, is equally hard to maintain, regardless which programming language is used.


Bookmark on your Personal Space


Edited Entry

A354629

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry

Categorised In:


Written by

Edited by

h2g2 Editors

References

h2g2 Entries

External Links

Not Panicking Ltd is not responsible for the content of external internet sites

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more