Description: | Returns whether or not an optional dummy argument is present (has an associated actual argument). | ||
Class: | Inquiry function; Generic | ||
Arguments: | A must be an optional argument of the current procedure. | ||
Results: | The result is a scalar of type default logical. The result is .TRUE. if A is present; otherwise, the result is .FALSE.. |
Examples
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