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)


and since prevTotal = 1

currTotal := 1 + (1)


prevTotal = 1.

currTotal = 2.


Yet what appears to be happening is...

prevTotal = 0

currTotal := 0 + (prevTotal := currTotal)


then the parentheses...

currTotal := 0 + (1)


prevTotal = 1.

currTotal = 1.


Care to school me?

Thanks!
Russ

-- 
Russ Whaley
whaley.r...@gmail.com

Reply via email to