1! Test optional character arguments. We still need to pass a string 2! length for the absent arguments 3program optional_string_1 4 implicit none 5 6 call test(1, "test"); 7 call test(2, c=42, b="Hello World") 8contains 9subroutine test(i, a, b, c) 10 integer :: i 11 character(len=4), optional :: a 12 character(len=*), optional :: b 13 integer, optional :: c 14 if (i .eq. 1) then 15 if (a .ne. "test") STOP 1 16 else 17 if (b .ne. "Hello World") STOP 2 18 if (c .ne. 42) STOP 3 19 end if 20end subroutine 21end program 22