Transfer practice · Join a label around a calculated value: return the text Supplies: 14 ready, after adding two deliveries of 7. The extra word must follow the number.
v3 · Activity 1 of 1 · numbers · strings · concatenation · 7 min Runs here
Use a familiar idea in a different task. Read the changed requirement before running.
Join a label around a calculated value: return the text Supplies: 14 ready, after adding two deliveries of 7. The extra word must follow the number.
Interface: Return the composed player display string.
| Input | Expected |
|---|---|
Label after calculation | "Supplies: 14 ready" |
local level = 3 + 2
return "Level " .. tostring(level)The addition calculates 5; joining text creates Level 5. return gives that complete text to the checker.
New syntax: .., tostring()
Numbers support arithmetic such as +, -, * and /. Text uses .. for concatenation. Joining "Level " and 4 creates text; it does not add a number to a sentence.
tostring converts a value into text intentionally. Some concatenations can coerce numbers, but making the conversion visible helps you distinguish calculation from presentation.
Calculate the result first, then turn it into a readable label. Quoted "12" is text; unquoted 12 is a number.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
name
level 3
earned 2
nextLevel level earned
name nextLevelThis is a private experiment copy. It does not replace your answer or complete the activity.
These inputs apply when your scratchpad returns the function described by the activity interface.
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.