18zehn
18zehn

Reputation: 182

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?

Upvotes: 0

Views: 369

Answers (1)

JJJ
JJJ

Reputation: 33143

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.)

Upvotes: 1

Related Questions