
.FORTRAN Concepts |
Parentheses can be used to override normal rules of precedence. The part of an ex- pression enclosed in parentheses is evaluated first. If parentheses are nested, the in- nermost are evaluated first.
15/3 + 18/9 = 5 + 2 = 7
15/(3 + 18/9) = 15/(3 + 2) = 15/5 = 3
The following lists the precedence of operators in descending order:
•Parenthesized expressions
•Exponentiation: **
•Multiplication/Division: *, /
•Addition/Subtraction: +, - (unary and binary)
•Relational Operators: .LT.,.LE.,.EQ.,.NE., .GT.,.GE.
•Logical/Boolean .NOT.
•Logical/Boolean .AND.
•Logical/ Boolean. 0 R.
•Logical/Boolean .EQV., .NEQV.
Thus, the expression
o .OR. A + 8 .GE. C
is interpreted as though it were written
o .OR. ((A + 8) .GE. C)
One exception to the
A**8**C
In this case, the exponentiation is interpreted
A * *(8 * *C)
2.2.5 Scope of Symbols
A symbolic name consists of one to six alphanumeric characters, the first of which must be alphabetic. Symbolic names may be global (that is, they may have a scope of the entire program) or they may be local to a program unit or statement function. A local symbol name can, therefore, represent different entities in different program units or in different statement functions.
The following symbolic names are global to the entire program and cannot be used in a local context.
•Main program name
•Subroutine names
•External function names
•BLOCK DATA subprogram names
The following symbolic names are local to the program unit in which they appear:
•Array names
•Variable names