order of execution
Posted by
Russ Whaley on
Sep 18, 2020; 1:05pm
URL: https://forum.world.st/order-of-execution-tp5122138.html
Can someone please explain this? I'm guessing I don't understand order of execution.
When perusing >>fibonacciSequence, I get a proper result, but I don't understand why when looking at the code.
Consider this fragment...
prevTotal := 0.
currTotal := 1.
currTotal := prevTotal + (prevTotal := currTotal).
My understanding *was* that parentheses are executed first.
(prevTotal := currTotal) - assigns and returns 1
currTotal := prevTotal + (1)
currTotal := 1 + (1)
prevTotal = 1.
currTotal = 2.
Yet what appears to be happening is...
prevTotal = 0
currTotal := 0 + (prevTotal := currTotal)
currTotal := 0 + (1)
prevTotal = 1.
currTotal = 1.
Care to school me?
Thanks!
Russ
--