GoTo Statement

Pages 2 (502 words)
Download 0
A goto statement induces your program to unreservedly direct the control to the statement integrated with the label assigned to the goto statement. It is considered to be a basic operation for passing the control from one segment of your program to another one.


A goto statement is a constituent of many languages like C, C++, COBOL, Pascal, Algol and others, especially of assembly languages. Nevertheless a goto statement is not popular in all higher-level languages of programming. Thus in Java goto statement is a reserved statement at present (Tribble 3).
During the period of early stage of structured programming development many experts in computer science arrived at a conclusion that in programs it is better to use "structured flow-control commands", for example, loops and "if-then-else statements" rather than a goto statement (Tribble 5). Though there are experts who consider that despite the fact that "goto statement considered harmful", there exist some problems in a great number of programming languages that can't be directly decided without a goto statement, like, for instance, exception handling or breaking out of nested loops (Knuth 268).
"There are few good uses for a goto statement. It is not uncommon for the class instructor to ban goto statements altogether. But the traditional legitimate use for a goto is to allow the programmer to escape from deep nesting when a special case (usually an error) has been encountered. For Pascal programmers, this means that, on rare occasion, you may want to goto'' the end of a subroutine in order to exit. ...
Download paper
Not exactly what you need?