• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with Augmented Argument Operators  RSS feed

 
E. Chu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Conceptually, the expressions I've commented above in green don't seem to evaluate to what I think they should be. It's probably a simple flaw in my logic, but I can't figure out the error.



For the fifth expression,
equals The above statement goes to Which further simplifies to or 4 by the Order of Operations. After compiling, it is 0.

For the seventh expression,
equals The above statement goes to Which further simplifies to or 6.5 by the Order of Operations. After compiling, it is 14.5.

For the eighth expression,
equals The above statement goes to Which further simplifies to or -1.5 by the Order of Operations. After compiling, it is 9.0.

 
Raymond Tong
Ranch Hand
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you have two main misunderstanding.
1) the change on statements roll down to next
i.e. "a" has been changed to "48" on 4th expression, so it is not "1"

2) x -= y + z is actually short form of x = x - (y + z)
not x = x - y + z
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!