Silverfrost Forums

Welcome to our forums

Compiling of logical tests

4 Jul 2016 7:13 #17728

I am just returning to FORTRAN after 40 years so the question may be silly. I set up a logical test

If (a<=c) then (do something) end if.

It does not compile properly but

If (a .le. c) then (do something) end if

Compiles with no problem. Have I just been away too long? Help!

5 Jul 2016 12:56 #17729

Which compiler did you use, and what options did you specify? What do you mean by 'did not compile properly'?

I tried this program with FTN95 7.2, and it worked fine:

program xle
implicit none
real a,b,c
a=5.0
c=7.0
if(a<=c)then
   b=a-c
   write(*,*)b
endif
end
7 Jul 2016 5:04 #17752

Sorry for the long delay. Thank you for the quick response mecej4. It was pure brain fade on my part. Clearly If (a = 1) then is an incorrect logical and should be If (a == 1) then ... It is surprising me how slowly FORTRAN is coming back to me but I will get there. I turn 80 next year and am planning on using it for the next 20 years.

Please login to reply.