next up previous contents
Next: Initialisation Up: Data Objects Previous: Character Declarations

 

Constants (Parameters)

Symbolic constants, oddly known as parameters in Fortran, can easily be set up either in an attributed declaration or in a PARAMETER statement (it is recommended that the attributed form be used):

    INTEGER price_of_fags            ! F77 style - not recommended
    PARAMETER (price_of_fags = 252)  ! F77 style - not recommended
    REAL, PARAMETER ::  pi = 3.14159 ! F90 style

CHARACTER constants can assume their length from the associated literal (LEN=*), they can also be declared to be fixed length:

    CHARACTER(LEN=*), PARAMETER :: son = 'bart', dad = "Homer"

Parameters should be used:


next up previous contents
Next: Initialisation Up: Data Objects Previous: Character Declarations

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.