Does Fortran Use Arithmetic If Statements?

  • Context: Fortran 
  • Thread starter Thread starter gholamghar
  • Start date Start date
  • Tags Tags
    Fortran Type
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
gholamghar
Messages
23
Reaction score
0
Fortran has this type of "If"?

Hi,
I was reading a code from a thesis, obviously the quality of the scan was not good and I reached to this point in the image below, that the programmer uses "If" statements:

http://i48.tinypic.com/x5z7n.jpg


I am not sure if he uses a "=" sign or a"-" sign for his statement. I mean this is "If (SPFR - .1) 21, 21, 2" or (SPFR = .1) 21, 21, 2"?
do we have such a thing in fortran for an If statement using a minus sign?

Thanks Frotran Masters!
 
Physics news on Phys.org


gholamghar said:
Hi,
I was reading a code from a thesis, obviously the quality of the scan was not good and I reached to this point in the image below, that the programmer uses "If" statements:

http://i48.tinypic.com/x5z7n.jpg


I am not sure if he uses a "=" sign or a"-" sign for his statement. I mean this is "If (SPFR - .1) 21, 21, 2" or (SPFR = .1) 21, 21, 2"?
The symbol is -, not =. This is a very old style in Fortran, and it's called an "arithmetic if" statement.

It's equivalent to these statements:

if (SPFR - .1 < 0) goto 21
if (SPFR - .1 == 0) goto 21
if ((SPFR - .1 > 0) goto 2
gholamghar said:
do we have such a thing in fortran for an If statement using a minus sign?

Thanks Frotran Masters!
That would be Fortran...
 


Mark44 said:
The symbol is -, not =. This is a very old style in Fortran, and it's called an "arithmetic if" statement.

It's equivalent to these statements:

if (SPFR - .1 < 0) goto 21
if (SPFR - .1 == 0) goto 21
if ((SPFR - .1 > 0) goto 2

That would be Fortran...

Thank you so much Mark44, you are awesome! and knowledgeable:)