Logical to string, specifying the default value if the optional argument is not present.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in), | optional | :: | logical_value | ||
character(len=:), | intent(out), | allocatable | :: | string_value |
integer value stringified |
|
character(len=*), | intent(in) | :: | default_value |
default integer value |
subroutine optional_logical_to_string(logical_value, string_value, default_value) logical,intent(in),optional :: logical_value character(len=:),allocatable,intent(out) :: string_value !! integer value stringified character(len=*),intent(in) :: default_value !! default integer value if (present(logical_value)) then if (logical_value) then string_value = 'True' else string_value = 'False' end if else string_value = default_value end if end subroutine optional_logical_to_string