ReferenceVerse

Immutable By Default

immutable by default

Updated
Watch the Knot — immutable-by-default in ~90 seconds.

One solid hit on the arena dummy and your pirate score ticks up, but the 50 points needed to capture the flag never budges.

In Verse, values are locked down by default, so your win condition stays safe while your live game state is free to change.

We declare WinScore with a standard colon to lock it at 50, then use var and set to let CurrentScore tick up by 10 on every hit.

Reach for standard declarations to lock your game rules, and var when a value needs to evolve during the match.

WinScore : int = 50
var CurrentScore : int = 0
set CurrentScore += 10
Print("{CurrentScore} / {WinScore}")

Build your own lesson with immutable-by-default

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

Build a lesson →