<!-- it is always a good idea to initialize your variables, but with arrays it is particularly important --> (set: $inventory to (a:)) (set: $chest to (a: 'a shield', 'a suit of armor')) (set: $chestOpen to false)You are currently carrying: <!-- if the inventory contains nothing, show "nothing" -->\ (if: $inventory's length is 0)[\ nothing. ](else:)[\ <!-- we iterate over the array and print each item -->\ (for: each _item, ...$inventory)[\ _item (unless: $inventory's last is _item)[, ]\ ]. ] ----- <!-- we use the + operator and wrap the target elements in an (a:) macro to add to the array -->\ You find yourself inside a small room. In the corner, you see a sword, and decide to pick it up. (set: $inventory to it + (a: 'a sword'))\ [[Continue|hallway]]You see a chest here in the hallway. \ (unless: $chestOpen)[\ Do you want to open it? { (link: 'Open the chest.')[ <!-- adding to arrays together can also be done with the + operator --> (set: $inventory to it + $chest) (set: $chestOpen to true) (goto: 'chest') ] } ](else:)[\ It's open, and there's nothing inside. ]\ [[Move on.|dart trap]]Several darts shoot out of a wall at you! <!-- we can check to see if the player has a given item with the contains operator --> (if: $inventory contains 'a shield')[\ Luckily, your shield will protect you. ](else:)[\ With no way to defend yourself, you die. ]You open the chest and find (for: each _item, ...$chest)[\ _item (unless: $chest's last is _item)[ and ]\ ]. (link: 'Okay')[ (goto: (history:)'s last) ]