14.16. Review of Chapter 14: Numbers and Equations

| Chapter 14: Numbers and Equations |

| 14.16. Review of Chapter 14: Numbers and Equations

1. Numbers numbers may be manipulated by arithmetic with the forms either spelled out or represented as symbols:

> the score + 10
> 100 - the score
> 10 * 21
> 144 / 12
> the score plus 10
> 100 minus the score
> 10 times 21
> 10 multiplied by 21
> 144 divided by 12

We may change numbers that vary using "change" or "now"; the short hand "increase... by..." and "decrease... by..." allow us to do addition and subtraction a little more efficiently, as well:

> now the score is the score plus 10;
> increase the score by 10;
> decrease the score by 10.

2. New numerical kinds of value ("units") can be specified like this:

> A weight is a kind of value. 10kg specifies a weight.

There can be multiple notations for the same kind of value, with different relative scalings:

> A weight is a kind of value. 10kg specifies a weight. 1 tonne specifies a weight scaled up by 1000. 1g specifies a weight scaled down by 1000.

There can be equivalents on a different scale altogether:

> 1 ounce specifies a weight equivalent to 0.028kg.
> 1 pound specifies a weight equivalent to 16 ounce.

We can also mark some notations as singular or plural, and give them names:

> 1 tonne (singular, in tonnes) or 2 tonnes (plural, in tonnes) specifies a weight scaled up by 1000.

This enables us to say "[weight of the tank in tonnes]", for instance.

Alternatively, we can give notations combining several scales in one:

> Price is a kind of value. $1.99 specifies a price. [default $0.00]
> Price is a kind of value. $1.99 specifies a price with parts dollars and cents.
> Price is a kind of value. $1.99 specifies a price with parts dollars and cents (optional, preamble optional).
> An aspect ratio is a kind of value. 16:20 specifies an aspect ratio with parts width and height.

If we define a unit with parts, we may then refer to these parts separately:

> dollars part of the price of the apple
> cents part of the price of the apple

Once a unit has been defined, we can understand this unit in the player's input.

> Understand "sell [something] for [price]" as selling it for.

(For more about Understand sentences, see the chapter on Understanding.)

4. We can also perform arithmetic on units, and tell Inform how multiplication turns units into other units:

> the total weight of things on the platform divided by the number of things on the platform

> if the price understood is less than $0.50...
> if the price of the apple is more than $5.00, ...
> decrease the price of the apple by $0.50

> A length times a length specifies an area.

Previous | Contents | Next