Older high level languages (FORTRAN, COBOL, PL/I, etc) relied on GO TO statements. These statements allowed you, as a programmer, to have the program move from one set of code to another very easily. Unfortunately, using the GO TO greatly complicated the code in that, deciphering what it was doing was like tracing through a pile of spaghetti, thus the term spaghetti code. This example demonstrates the use of the FORTRAN IF and GO TO statements. The IF statement works like this:
IF (expression) number1, number2, number3
If the expression evaluates to a negative number, branch to location number1
If the expression evaluates to 0, branch to location number2
If the expression evaluates to a positive number, branch to location number3
This code is taken from the textbook figure 14.2 using the values I=10, J=10, K=3.