Hello,
I'm trying to do something very simple.
CODE
character*1 w,a,s,d
character*5 input
read *, input
if (input.eq.w) then
(execute something here)
if (input.eq.a) then
(something here)
(repeated for s and d)
end if
Looks right, doesn't it? So why on earth a program will not execute a the 'then (something here)' if the input is w,a,s,d?
Execution:
w
(program ended)
When it should be:
w
(executed something here)
(program ended)
The above code will work with integers, why won't it work with characters? I added another line to see what the input of "read *, input" is:
CODE
read *, input
print *, 'The input is ', input
if (input.eq.w) print *, 'great'
Guess what's the outcome?
w
w
(line not executed)
If input is w and w.eq.w why won't it execute the print statement?!?! This is so frustrating. This works with integers without a problem but does not want to work with characters, for whatever reason.