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

 

Numeric and Logical Declarations

 

Variables of a given type should be declared in type declaration statements at the start of a program unit. A simplified syntax follows,

 
< type > [,< attribute-list >] :: < variable-list > [ =< value > ]

The :: is actually optional, however, it does no harm to use it, moreover, if < attribute-list > or =< value > are present then the :: is obligatory.

The following are all valid declarations,

    REAL :: x 
    INTEGER :: i,j
    LOGICAL, POINTER :: ptr
    REAL, DIMENSION(10,10) :: y, z(10)
    DOUBLE PRECISION, DIMENSION(0:9,0:9) :: w

The DIMENSION attribute declares a tex2html_wrap_inline26938 array, this can be overridden as with z which is declared as a 1D array with 10 elements.

< attribute-list > represents a list of attributes such as PARAMETER, SAVE, INTENT, POINTER, TARGET, DIMENSION, (for arrays) or visibility attributes. An object may be given more than one attribute per declaration but some cannot be mixed (such as PARAMETER and POINTER).

Return to corresponding overview page gif


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

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.