ReferenceVerse

Logic And Or

logic and or

Updated
Watch the Knot — logic-and-or in ~90 seconds.

The clifftop pirate gate grinds open the moment you step on the trigger device, bypassing the missing silver key because your master key saves the day.

Verse uses the and operator to demand every condition succeeds, while or gives you a fallback path if the first check fails.

We query our logic flags with the question mark, chaining and for the gold and silver keys, then or to let the master key bypass them and unlock the gate.

Reach for and when every rule must pass, and or when any single condition can trigger the payoff.

clifftop_gate := class(creative_device):
    @editable Gate : lock_device = lock_device{}
    @editable Plate : trigger_device = trigger_device{}
    OnStepped(Agent : ?agent) : void =
        if (A := Agent?):
            HasGold : logic = true
            HasSilver : logic = false
            HasMaster : logic = true
            if ((HasGold? and HasSilver?) or HasMaster?):
                Gate.Unlock(A)

Build your own lesson with logic-and-or

Generate a personalized, compile-checked lesson grounded in this exact reference.

Build a lesson →