Inform 7 Home Page / Documentation


Chapter 11: Phrases

§11.1. What are phrases?; §11.2. The phrasebook; §11.3. Pattern matching; §11.4. The showme phrase; §11.5. Conditions and questions; §11.6. If; §11.7. Begin and end; §11.8. Otherwise; §11.9. While; §11.10. Repeat; §11.11. Repeat running through; §11.12. Next and break; §11.13. Stop; §11.14. Phrase options; §11.15. Let and temporary variables; §11.16. New conditions, new adjectives; §11.17. Phrases to decide other things; §11.18. The value after and the value before

arrow-up-left.png Contents of Writing with Inform
arrow-left.png Chapter 10: Scenes
arrow-right.png Chapter 12: Advanced Actions
arrow-down-right.png Indexes of the examples

§11.1. What are phrases?

Phrases are instructions to Inform to do something, or to decide whether something is true or false, or to produce a value, or to say something. Inform has around 350 phrases built-in, and the chapters so far have already defined about 100 of those. In this chapter we'll see some key phrases for organising instructions of what to do, and also see how to define entirely new phrases.

Just to run through the four sorts of phrase with examples:

(a) Phrases to do something. These are the ones used in the body of a rule. For example,

When Train Stop begins:
    move the Flying Scotsman to the Station;
    say "The Flying Scotsman pulls up at the platform."

Rules like this begin with a "preamble", the beginning part which tells Inform when or how they apply, and then follow on with a list of instructions - here, just two of them. "move ... to ..." and "say ..." are both phrases. Inform provides about 130 of these built-in. It's actually not quite true that they all do something, because one of them is:

do nothing

This phrase does nothing at all. It is very occasionally useful to make a rule which does nothing:

This is the largely ineffective rule:
    do nothing.

(b) Phrases to decide whether a condition is true. These are the ones which can be used in an "if":

if action requires light: ...

Not all conditions come from phrases. For example, "if the front door is closed" and "if Peter is wearing the sandals" have meanings which come from the verbs "to be" and "to wear". Inform provides about 60 built-in conditions, which give a friendly wording for questions which would be lengthy or difficult to write in any other way.

(c) Phrases to decide a value. For example:

square root of 16

produces a number, 4 of course, and can be used whenever a number is expected. Inform provides about 100 built-in phrases like this.

(d) Text substitutions. These are actually just phrases whose definition begins with "To say ...". Example:

"It's now [time of day in words]."

Inform provides about 60 built-in text substitutions.


arrow-up.png Start of Chapter 11: Phrases
arrow-left.png Back to Chapter 10: Scenes: §10.9. Why are scenes designed this way?
arrow-right.png Onward to §11.2. The phrasebook