Transfer practice · The equipment room uses a different rule: a visitor needs a pass AND the room must not be under maintenance. Implement canUseRoom(hasPass, maintenance). A pass alone no longer suffices.
v3 · Activity 1 of 1 · or · and · not · boundaries · 11 min Learning simulation
Use a familiar idea in a different task. Read the changed requirement before running.
The equipment room uses a different rule: a visitor needs a pass AND the room must not be under maintenance. Implement canUseRoom(hasPass, maintenance). A pass alone no longer suffices.
Interface: canEnter(playerLevel, requiredLevel, hasPass) -> boolean
| Input | Expected |
|---|---|
Pass and opentrue, false | true |
Pass but maintenancetrue, true | false |
Open without passfalse, false | false |
local function canUseBench(hasReservation, isOpenDay)
return hasReservation or isOpenDay
end
return canUseBenchA reservation and an open day are alternative routes. No reservation on an open day still permits use.
New syntax: or, and, not
The rule is: a visitor reaches the required level OR has a pass. The level route includes equality, so it needs >=. The pass is another route, not an extra requirement.
or succeeds when either condition is true. and would require both. not reverses truthiness; not hasPass describes a visitor without a pass.
The gate picture is labeled Learning simulation. It reads the actual evaluated return value. It is not a Roblox server, and its access logic alone does not implement secure multiplayer permissions.
Try every visible case. The starter passes a visitor above the requirement but fails equal-level visitors and low-level visitors with a pass. Passing one example is not enough.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
canEnterplayerLevel, requiredLevel, hasPass
playerLevel requiredLevel
canEnterThis 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.