Read a named entry, calculate a new value, then store it back under the same name. Other entries keep their values.
Increase lamps by 2 instead of 1, then display lamp stock 4 and unchanged bolt stock 3.
4 3
Lines must stay in order. Spelling, capitalization and spaces inside a message matter.
local stock = { keys = 2 }
stock.keys = stock.keys + 1
print(stock.keys)The update stores 3 under keys.
New syntax: stock.lamps = stock.lamps + 1
stock.lamps = stock.lamps + 1 works like a variable update: read 2, add 1, store 3. stock.bolts still holds 3.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
stock lamps 2, bolts 3
stock.lamps stock.lamps 1
stock.lamps
stock.boltsThis 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.