Transfer practice · Return {hasPass=false, visits=0, nickname="", sponsorType="nil"}. The empty nickname and zero visits are real values; only sponsor is absent.
v3 · Activity 1 of 1 · booleans · nil · types · 8 min Runs here
Use a familiar idea in a different task. Read the changed requirement before running.
Return {hasPass=false, visits=0, nickname="", sponsorType="nil"}. The empty nickname and zero visits are real values; only sponsor is absent.
Interface: Return a table with enabledType, brightnessType, labelType, ownerType.
| Input | Expected |
|---|---|
Empty but present values | { hasPass = false, visits = 0, nickname = "", sponsorType = "nil" } |
local enabled = false
local owner
print(type(enabled))
print(type(owner))
return { enabledType = type(enabled), ownerType = type(owner) }A deliberate false remains boolean. The unassigned owner is nil. Neither should be silently replaced by the text "false".
New syntax: nil, type()
true and false are booleans. nil means no value; a local declared without an assignment starts as nil. type reports a basic language type as text.
The text "false" is a string and the number 0 is a number. Neither is the boolean false. Quotes change meaning.
A table groups named results here so the checker can inspect all four labels. Dictionary tables are explored fully in Chapter 4. Read each key as a label for its result.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
enabled
brightness
label
owner
enabledType enabled, brightnessType brightness, labelType label, ownerType owner This 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.