you are viewing a single comment's thread
view the rest of the comments
[–] 4 points 10 months ago*

Remember that Fortran has an arithmetic if statement. You can write

IF (expression) s1, s2, s3

where s1, s2 and s3 are labels. If the expression is negative, it jumps to s1. If it's 0, to s2 and if it's positive, to s3.

It also has goto variable. You can do

INTEGER a
ASSIGN 20 TO a
ASSIGN 17 TO a
GO TO a
20 PRINT *, "foo"
17 PRINT *, "bar"

and it'll print "bar". In this snippet of code, everything seems quite logical, but imagine debugging spaghetti code written using these patterns.

Oh, it also has GO TO (s1, s2, ... , sn), N

First, N is converted to an integer. If N is 1, it goes to label s1. If N is 2, it goes to s2. If N is less than 1 or greater than n, it does nothing.

  • source