ReferenceVerse

Map Key Value

map key value

Updated
Watch the Knot — map-key-value in ~90 seconds.

A player taps the plaza market stall, and the vendor instantly quotes eleven coins for an apple without counting the stock.

A Verse map links unique keys to values, like matching fruit names to their prices, so you can look up any item in a flash.

We define our map with string keys and int values, then use an if-let to safely pull the price for an apple, printing it if it exists.

Reach for a map whenever you need to pair unique identifiers with game data, like player IDs to scores or item names to stats.

Prices : [string]int = map{"apple" => 11, "pear" => 7}
if (Cost := Prices["apple"]):
    Print("Costs {Cost} coins")

Build your own lesson with map-key-value

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

Build a lesson →