ReferenceDevices

Mutable Var Set V6

Student can declare `var Count:int = 0`, mutate it with `set`, and explain why plain values are immutable in Verse.

Updated
Watch the Knot — mutable_var_set_v6 in ~90 seconds.

Your pirate just looted the beached galleon’s captain's cabin, and the gold counter on your HUD finally ticks up to fifty.

In Verse, plain values are immutable and locked forever like the ship's max cargo capacity, but a var is a mutable pouch that changes as you play.

We declare MaxGold as a fixed constant, create a var Gold that can change, and use the set keyword to add our new loot to the pouch.

Reach for var and set whenever your game state needs to evolve during a match, like tracking health, scores, or inventory.

MaxGold := 100
var Gold : int = 0
set Gold = Gold + 50
Print("{Gold} of {MaxGold}")

Build your own lesson with mutable_var_set_v6

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

Build a lesson →