The PRESENT function determines whether or not an optional argument is present.
a is INTENT(IN) and must be an optional dummy argument of the procedure in which the PRESENT function appears.
The result is a scalar default LOGICAL.
Its value is true if the actual argument corresponding to a was provided in the invocation of the procedure in which the PRESENT function appears; otherwise, it is false.
Examplefunction fun1(a,b) real :: fun1,a real,optional :: b if(present(b)) then ! don't reference b unless fun1=a+b ! it is present else fun1=a end if end function