inform7

How to define a list in Inform7


I am trying to define a list in Inform7 but it won't work.

Contacts is a list {"Melissa", "Paul"};

That does not work. Can you tell me how to define a list to which elements can be added?


Solution

  • You'll need to first define what kind of values the list holds before you can define what actual values it holds.

    Contacts is a list of text that varies. Contacts is {"Melissa", "Paul"}.
    

    This creates a global list that's accessible from anywhere. In rules and phrases you can create a list of constants (text, in this case) with a shorthand:

    Instead of examining the phone book:
       let contacts be {"Melissa", "Paul"};
        ...
    

    (See also Writing with Inform §21.2.)