Error Messages/43000

< Error Messages
Revision as of 19:06, 3 March 2025 by Lchrisman (talk | contribs) (Created page with "== Example Error Message== : Lexical error at line 1: : <code>Choice(['US','Canada'], 1)</code> : <code>       ↑</code> : Expected an i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example Error Message

Lexical error at line 1:
Choice(['US','Canada'], 1)
       ↑
Expected an index for «I», the first parameter of Choice.

Description

A call to a function attempted to pass something other than an index to a parameter that expects and index. In the example above, a literal list was passed in where Choice expects an index identifier as its first parameter.

In the above case involving Choice, one resolution would be to set the Domain attribute to be ['US', 'Canada'] (i.e., a list of text), and then change the Definition to be Choice( Self, 1 ). That applies to a few functions that can use their own domain as the index.

More generally, the typical resolution is to create a new Index variable, e.g.,

Index Country ::= ['US', 'Canada']

And then change the Definition to Choice( Country, 1 ), where you pass the index identifier instead of the value.

Comments


You are not allowed to post comments.