Variables can be given initial values:
REAL :: x, y =1.0D5 INTEGER :: i = 5, j = 100 CHARACTER(LEN=5) :: light = 'Amber' CHARACTER(LEN=9) :: gumboot = 'Wellie' LOGICAL :: on = .TRUE., off = .FALSE. REAL, PARAMETER :: pi = 3.141592 REAL, PARAMETER :: radius = 3.5 REAL :: circum = 2 * pi * radius
gumboot will be padded, to the right, with blanks.
In general, intrinsic functions cannot be used in initialisation expressions, the following can be: REPEAT, RESHAPE, SELECTED_INT_KIND, SELECTED_REAL_KIND, TRANSFER, TRIM, LBOUND, UBOUND, SHAPE, SIZE, KIND, LEN, BIT_SIZE and numeric inquiry intrinsics, for, example, HUGE, TINY, EPSILON.
For more information, click here