choices.tri (513B)
1 !export * 2 3 -- Choose a message by matching an input. 4 message 0 = "Your basket is empty." 5 message 1 = "You have one item." 6 message _ = "You have several items." 7 8 -- These equations are tried from top to bottom. 9 -- _ matches any remaining input: this is the fallback. 10 emptyBasket = message 0 11 oneItem = message 1 12 fullBasket = message 4 13 14 -- Try adding a message for 2 items before the fallback equation. 15 -- Keep the equations together so they define one function. 16 -- Next: a Practical Example, or Language reference.