Hello!
I'm trying to create a way for one variable to be the sum of several other variables, and the old internet search didn't come up with an answer that worked for me. Any advice is greatly appreciated!
Example that shows my intention, but is flawed coding/not resulting in the total addition of all variables equalling the $totalsum variable:
<<set $totalsum = $variable1 + $variable2 + $variable3 + $variable4>>
Thank you for any help you can offer!
Comments
Sometimes you're just missing a couple of brackets. Works as intended! Thank you
The plot thickens, actually.
I thought my problem was the missing brackets. TURNS OUT I had confused "eq" with "=".
I did a test just now by removing the brackets, and the equation still works as intended.
In my code, I had set up the values I wanted to add together using "eq" instead of "=", so none of them were working.
The fact that <<if $thing = true>> actually equates to <<set $thing as true>> I find really hard to remember for some reason.
I considered tattooing 'set = if ==' somewhere to my person but instead I plan to pummel myself over the head with this book in the hope that something gets through in osmosis: http://www.amazon.co.uk/Python-Kids-Playful-Introduction-Programming/dp/1593274076