GO TO Statement
GO TO statement
GO TO statement permanently transfers control from one part of program to other
part of program.
GO TO Paragraph-name.
DISPLAY 'MAINPARA STARTS HERE'.
GO TO PARA-1.
DISPLAY 'A VALUE ', A.
COMPUTE A = B + C.
In above exmaple, control first executes the DISPLAY statement to display the string
' MAINPARA STARTS HERE' , then control executes GO TO statement, now control will go
to PARA-1 and executes COMPUTE statement. that's it. control wont come back to next
statement after GO TO, because control permanently transfered to PARA-1
- Structured programming languages techniques suggest to avoid using GO TO ,
use PERFORM instead
- Programmer may face more logic errors with GO TO compare than PERFORM
- Readability of programs goes down, if we use more GO TO statements in the program