I have the following code:
program test
implicit none
call test_routine("TEST")
call test_routine("TEST",.true.)
end program
subroutine test_routine(var1,var2)
implicit none
character(*) :: var1
logical, optional :: var2
write(*,*) len_trim(var1)
write(*,*) var1
end
The output looks like this:
0
4
TEST
Why does this occur? I would expect the function to behave the same whether the var2
argument is present or not.