IF (expression) S1,S2,S3S1,S2,S3 are three statement labels (they need not all be different) If the expression is negative the program goes to statement S1, if zero it goes to S2 and if positive S3. This form of IF tends not to be used so often nowadays although there are times when it is an elegant solution to a problem, for example :-
C Solution of a quadratic equation PRINT *,'PLEASE TYPE IN A,B, and C' READ *,A,B,C TEMP=B**2-4.*A*C IF (TEMP) 10,20,30 10 PRINT *,'THE ROOTS ARE IMAGINARY" STOP 20 ROOT=-B/2.*A PRINT *,'THE ROOTS ARE EQUAL AND HAVE THE VALUE ',ROOT STOP 30 ROOT1=(-B+SQRT(TEMP))/2.*A ROOT2=(-B-SQRT(TEMP))/2.*A PRINT *,'THE ROOTS ARE',ROOT1,ROOT2 STOP END
The term SQRT(TEMP) means take the square root of TEMP. Incidently, the above program also contains a classic mistake that even experienced users (including the author!) have been known to make. What is it ?