(either: …Any) → Any

Give this macro several values, separated by commas, and it will pick and return one of them randomly.

Example usage:

A (either: "slimy", "goopy", "slippery") puddle will randomly be “A slimy puddle”, “A goopy puddle” or “A slippery puddle”.


There are plenty of occasions where you might want random elements in your story: a few random adjectives or flavour text lines to give repeated play-throughs variety, for instance, or a few random links for a “maze” area. For these cases, you'll probably want to simply select from a few possibilities. The (either:) macro provides this functionality.


As with many macros, you can use the spread ... operator to place all of the values in an array or dataset into (either:), and pick them randomly. (either: ...$array), for instance, will choose one possibility from all of the array contents.

If you want to pick two or more values randomly, you may want to use the (shuffled:) macro, and extract a subarray from its result.

See also:

(random:), (shuffled:)