Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
real(kind=8), | intent(in) | :: | x | |||
real(kind=8), | intent(in), | optional | :: | y |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | fmt_x | |||
character(len=:), | public, | allocatable | :: | fmt_y |
subroutine print_value(name, x, y)
character(len=*), intent(in) :: name
real(8), intent(in) :: x
real(8), intent(in), optional :: y
character(len=:), allocatable :: fmt_x, fmt_y
call to_string(x, fmt_x)
if (present(y)) then
call to_string(y, fmt_y)
fmt_x = fmt_x//' , '//fmt_y
end if
write(6,'(a)') name//fmt_x
end subroutine print_value