Transfer practice · Start with 2. Add 5 to the same variable twice, then display the final number 12 once. The second update must use the value left by the first.
v3 · Activity 1 of 1 · assignment · state-updates · 2 min Runs here
Use a familiar idea in a different task. Read the changed requirement before running.
Start with 2. Add 5 to the same variable twice, then display the final number 12 once. The second update must use the value left by the first.
12
Lines must stay in order. Spelling, capitalization and spaces inside a message matter.
local score=3
score=score+4
print(score)The update stores 7 before it is displayed.
New syntax: coins = coins + 5
On the second line, the right side is calculated first using the current value. The left side names the variable that receives the result.
The count starts at 10. Adding 5 stores 15. A later print reads the updated value, rather than the original 10.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
10
5
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.