Chapter 11: Phrases
11.14. Phrase options

There are often several slightly different ways to perform a given task but which have substantially the same definition. In the following example:

To go hiking, into the woods or up the mountain:
    if into the woods then say "Watch out for badgers.";
    if up the mountain then say "Better take your compass.";
    say "You go hiking."

...a phrase has been set up which can be used in three ways:

go hiking;
go hiking, into the woods;
go hiking, up the mountain;

Note that commas must be used to divide these "phrase options" from the rest of the text of the phrase. Within the definition of the phrase, the option's name is a valid condition, and

if up the mountain, ...

tests whether it is set; we can also test if it is not set using:

if not up the mountain, ...

A more substantial example from the standard rules is given by the Inform list-writer, which produces lists of things to specifications we choose. For instance:

list the contents of Marley Wood, as a sentence, with newlines
and including all contents;

Note that this phrase is allowed to have multiple options specified, whereas "go hiking" above was not: this is because it was defined thus:

To list the contents of (something - an object), with newlines, indented, as a sentence, including contents, including all contents, giving inventory information, giving brief inventory information, using the definite article, listing marked items only, prefacing with is/are, not listing concealed items, suppressing all articles and/or with extra indentation: ...

The significant difference is the word "and/or" instead of "or", which signals that more than one option can apply at a time.


176
** Example  Equipment List
Overview of all the phrase options associated with listing, and examples of how to change the inventory list into some other standard formats.

RB


PreviousContentsNext