[GRASS-dev] [GRASS GIS] #2986: r.mapcalc with same variable on LHS and RHS

GRASS GIS trac at osgeo.org
Tue Jun 14 20:16:34 PDT 2016

#2986: r.mapcalc with same variable on LHS and RHS
  Reporter:  mankoff      |      Owner:  grass-dev@…
      Type:  defect       |     Status:  closed
  Priority:  major        |  Milestone:  7.0.4
 Component:  Docs         |    Version:  7.0.3
Resolution:  fixed        |   Keywords:  r.mapcalc
       CPU:  Unspecified  |   Platform:  Unspecified

Comment (by wenzeslaus):

 Replying to [comment:9 glynn]:
 > The result of any expression can be assigned to a variable; that's what
 "=" does.

 Do I understand it correctly that re-assigning a variable inside sub-
 expression like in the following example is OK?

 r.mapcalc "a = eval(x = 1., x = x * 3, x / 2)"

 In other words, can I use the above without any bad consequences?

Ticket URL: <https://trac.osgeo.org/grass/ticket/2986#comment:12>
GRASS GIS <https://grass.osgeo.org>

More information about the grass-dev mailing list