v3 · Activity 4 of 8 · assignment · state-updates · 3 min Runs here
Read the current value of coins, add 5, then store the result back in coins. Run this example to observe the updated value.
Run the local-variable example. Its update uses addition (+) and should display the number 15.
15
Lines must stay in order. Spelling, capitalization and spaces inside a message matter.
local score = 2
score = score + 4
print(score)The update stores 6, which the final print reads.
New syntax: coins = coins + 5
Worked example: read 10, add 5, store 15, then print 15. This describes the shown code; it is not an execution trace of other programs.
= is an update operation. It does not mean the two sides are mathematically equal.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
10
5
This explains the fixed example above.
This is a private experiment copy. It does not replace your answer or complete the activity.
Your output will appear here.
Replace this code with the starter? Download your draft to keep a copy.
Your output will appear here.
Sign in with RoCreators to save private progress across devices. Community verification is separate.