Integer to string, specifying the default value if the optional argument is not present.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | optional | :: | int_value |
integer value |
|
character(len=*), | intent(out) | :: | string_value |
integer value stringified |
||
character(len=*), | intent(in) | :: | default_value |
default integer value |
subroutine optional_int_to_string(int_value, string_value, default_value) integer, intent(in), optional :: int_value !! integer value character(len=*), intent(out) :: string_value !! integer value stringified character(len=*), intent(in) :: default_value !! default integer value if (present(int_value)) then call integer_to_string(int_value, string_value) else string_value = default_value end if end subroutine optional_int_to_string