On Fri, 27 Aug 2021, Gabor Grothendieck writes: > Are there any guarantees of whether x will equal 1 or 2 after this is run? > > (x <- 1) * (x <- 2) > ## [1] 2 > x > ## [1] 2
At least the "R Language Definition" [1] says "The exponentiation operator ‘^’ and the left assignment plus minus operators ‘<- - = <<-’ group right to left, all other operators group left to right. That is [...] 1 - 1 - 1 is -1" which would imply 2. [1] https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Infix-and-prefix-operators -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel