Handle optional character(len=*) value
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in), | optional | :: | input_value | ||
| character(len=*), | intent(in) | :: | default_value |
pure function optional_char(input_value, default_value) result(output) !! Handle optional character(len=*) value character(len=*), intent(in), optional :: input_value character(len=*), intent(in) :: default_value character(len=:), allocatable :: output if (present(input_value)) then output = input_value else output = default_value end if end function optional_char