File tree 1 file changed +20
-1
lines changed
proposals/default_optional_arguments
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,26 @@ This addition to the language would not break any existing standard
102
102
conforming Fortran program, and thus preserves Fortran's backward
103
103
compatibility.
104
104
105
- 4. Further discussion
105
+ 4. Related intrinsic functions
106
+
107
+ 4.1 present()
108
+
109
+ When the optional dummy argument has an initializer, the function
110
+ present() will return .true., even if the actual argument is not passed
111
+ by the caller.
112
+
113
+ Example:
114
+
115
+ real function foo(a, b)
116
+ real, intent(in), optional :: a
117
+ real, intent(in), optional :: b = 0
118
+ print*, present(a) !.true. if an actual argument is provided
119
+ !by the caller, .false. otherwise
120
+ print*, present(b) !always .true. due to the initializer
121
+ end function foo
122
+
123
+
124
+ 5. Further discussion
106
125
107
126
Online discussion that led to this proposal can be found at
108
127
https://github.com/j3-fortran/fortran_proposals/issue/22.
You can’t perform that action at this time.
0 commit comments