View previous topic :: View next topic |
Author |
Message |
Greg100
Joined: 04 Jul 2016 Posts: 2
|
Posted: Mon Jul 04, 2016 8:13 pm Post subject: Compiling of logical tests |
|
|
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! |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Tue Jul 05, 2016 1:56 am Post subject: |
|
|
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:
Code: | 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 |
|
|
Back to top |
|
|
Greg100
Joined: 04 Jul 2016 Posts: 2
|
Posted: Thu Jul 07, 2016 6:04 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
|