Goto

goto is a statement in many programming languages. It is a combination of the English words go and to. It is a way to jump to another line of code.

Many languages support the goto statement, and many do not. In Java, goto is a reserved word, but cannot be used. (A reserved word is a word that is a part of the programming language and cannot be used for other things like naming variables.)

In Computer Science, there is a theory called the structured program theorem. This theory says that any program can be written in such a way that things are done with functions and methods (smaller sub-programs) instead of in one very big program and goto statements. The theory proves that the goto statement is not needed to write programs.

 Use 
A goto statement is usually used with a label. A label is a word that identifies a place in a piece of code. A goto statement in code usually looks like this:

 goto LABEL

In this example, the computer would jump to the location of LABEL.

Many times the goto statement is, combined with the if statement. In this case, the computer will only jump to another place in the code if something is true. For example:

 IF condition THEN goto LABEL

This can be read as "if some condition is true, then go to the location of LABEL."

Different programming languages have different restrictions or limits on the use of goto statements. For example, the C programming language does not allow a goto to jump to a location inside of another function (subprogram).

 References 

Category:Computer programming