Inform 7 Home Page / Documentation


§16.3. Corresponding entries

Continuing our example of the elements:

paste.png Table 2.1 - Selected Elements

Element

Symbol

Atomic number

Atomic weight

"Hydrogen"

"H"

1

1

"Iron"

"Fe"

26

56

"Zinc"

"Zn"

30

65

"Uranium"

"U"

92

238

If we want to know the atomic number of Uranium, say, it seems artificial to have to talk about the particular row number where the information happens to be. So we are also allowed to cross-reference, like so:

the atomic number corresponding to a symbol of "Fe" in the Table of Selected Elements

This results in 26, and similarly

the symbol corresponding to an atomic number of 26 in the Table of Selected Elements

results in "Fe". But we have to be careful:

the element corresponding to an atomic number of 27 in the Table of Selected Elements

This is not allowed (it produces an error at run-time), because there is no row with atomic number 27 in this rather limited table. We can check this in advance with the condition:

if there is an element corresponding to an atomic number of 27 in the Table of Selected Elements ...

Or more simply:

if there is an atomic number of 27 in the Table of Selected Elements ...

The condition "if there is..." can be used with any reference to a table entry: for instance, "if there is a symbol in row 5 of the Table of Selected Elements" would be false, because there are only four rows.


arrow-up.png Start of Chapter 16: Tables
arrow-left.png Back to §16.2. Looking up entries
arrow-right.png Onward to §16.4. Changing entries

***ExampleDubai
An elevator which connects any of 27 floors in a luxury hotel.