Syntax error found .and. and .or.

I just wanted to change a small part of a very old program, and I can’t understand in my whole life what I did to anger the Fortran gods.

The source code has the following line:

  if (r.gt.rstep) xappad = xappad*fakm

which I changed to:

  if (r.gt.0.58*rstep .and. r.lt.1.42*rstep) .or. (r.gt.2.08*rstep 
 : .and. r.lt.2.92*rstep) xappad = xappad*fakm

Which gives me errors:

sp-co-2-MODIFIED.for (785): error # 5082: syntax error found by '.OR.' while waiting for one of: BLOCK BLOCKDATA PROGRAM MODULE TYPE COMPLEX BYTE CHARACTER DOUBLE DOUBLECOMPLEX ...

      if (r.gt.0.58*rstep .and. r.lt.1.42*rstep) .or. (r.gt.2.08*rstep 
-------------------------------------------------------------------------^

sp-co-2-MODIFIED.for (786): error # 6090: an operand with parameters is required in this context.

     : .and. r.lt.2.92*rstep) xappad = xappad*fakm
------^

sp-co-2-MODIFIED.for (786): error # 6087: an array assignment operator is required in this context.

     : .and. r.lt.2.92*rstep) xappad = xappad*fakm
-------------------------------------------^
+5
source share
1 answer

FORTRAN, , :

if ((r.gt.0.58*rstep .and. r.lt.1.42*rstep) .or. (r.gt.2.08*rstep .and. r.lt.2.92*rstep)) xappad = xappad*fakm
+15

All Articles