PRESENT (opt-argument)
Class: Inquiry function - Generic
Returns whether or not an optional dummy argument is present (has
an associated actual argument).
Example:
Consider the following:
SUBROUTINE CHECK (X, Y)
REAL X, Z
REAL, OPTIONAL :: Y
...
IF (PRESENT (Y)) THEN
Z = Y
ELSE
Z = X * 2
END IF
END
...
CALL CHECK (15.0, 12.0) ! Causes B to be set to 12.0
CALL CHECK (15.0) ! Causes B to be set to 30.0