]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/present.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / present.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: PRESENT
7
8 .. _present:
9
10 PRESENT --- Determine whether an optional dummy argument is specified
11 *********************************************************************
12
13 .. function:: PRESENT(A)
14
15 Determines whether an optional dummy argument is present.
16
17 :param A:
18 May be of any type and may be a pointer, scalar or array
19 value, or a dummy procedure. It shall be the name of an optional dummy argument
20 accessible within the current subroutine or function.
21
22 :return:
23 Returns either ``TRUE`` if the optional argument :samp:`{A}` is present, or
24 ``FALSE`` otherwise.
25
26 Standard:
27 Fortran 90 and later
28
29 Class:
30 Inquiry function
31
32 Syntax:
33 .. code-block:: fortran
34
35 RESULT = PRESENT(A)
36
37 Example:
38 .. code-block:: fortran
39
40 PROGRAM test_present
41 WRITE(*,*) f(), f(42) ! "F T"
42 CONTAINS
43 LOGICAL FUNCTION f(x)
44 INTEGER, INTENT(IN), OPTIONAL :: x
45 f = PRESENT(x)
46 END FUNCTION
47 END PROGRAM