Returns option
if present or default
if not.
Unlike the other members of the get_option_with_default interface, we cannot mark this routine as elemental due to the allocatable return type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in), | optional | :: | option | ||
character(len=*), | intent(in) | :: | default |
pure function get_option_with_default_character(option, default) result(option_out)
implicit none
character(len=*), intent(in), optional :: option
character(len=*), intent(in) :: default
character(len=:), allocatable :: option_out
if( present(option) ) then
option_out = option
else
option_out = default
end if
end function get_option_with_default_character