vendredi 6 juillet 2018

Fortran 77 - "Cannot assign to a named constant at (1)" in if statement

Here's what I'm trying to run:

if (z.le.zstart) then
   if (y.ge.((6.95*wg_y2)/5)).and.(y.le.((12.55*wg_y2)/5)) then
      indexmedia=nd
   end if
end if

For context,

zstart is an arbitrary line of constant y.

wg_y2 = 5e-6

And for some reason it doesn't like the (y.ge.((6.95*wg_y2)/5)) bit, as the (1) was placed at the end of that bit.

I had a suspicion that it doesn't like anything that isn't an integer in the if statement but I changed 6.95 to 7 and 12.55 to 13 and it still didn't like it. Perhaps it needs to end up resolving to an integer?

I need these parameters to end up to

6.95 < y < 12.55 though.

Is there a workaround for this?

Aucun commentaire:

Enregistrer un commentaire