An arithmetic IF is an executable branching statement. It is a very arachic structure in Fortran and could be removed from a future Fortran standard. Therefore, you should never use this in any new programs that you write.
In ancient Fortran, the Arithmetic IF provided a way for Fortran to branch to different program statements based upon the evaluation of an arithmetic expression that followed the if statement. This function has been superseded by the present capabilities of Fortran and the arithmetic if should never be used in any program you write.
if ( mathematical expression ) label number, label number, label number
The mathematical expression is first evaluated and its value is determined. Now, if the expression evaluates to be less than zero the program will branch to the first label number that follows the mathematical expression. If the expression evaluated to be equal to zero, then the program would branch to the second label number following the expression. Finally, if the expression evaluated to be greater than zero, then the program would branch to the last of the label numbers.
The following is what an arithmetic if looks like. Remember, avoid using this structure in any programs you write. The only reason why it is introduced is to show you what one looks like just in case you run into one when modifying an earlier Fortran program. The structure looks like the following.
If (b**2-4*a*c) 100,200,300, 100 print*, 'Roots are complex' Go to 400 200 print *, ' single real root ' Go to 400 300 print *, 'two real roots' 400 continue
In this type of structure the program branches to label 100 if the arithmetic expression in parenthesis evaluates to less than zero, or to 200 if it evaluates to be equal to zero or would branch to 300 if it evaluates to greater than zero.
Written by Jason Wehr : firstname.lastname@example.org and Maintained by John Mahaffy : email@example.com