Error Messages/40052

< Error Messages
Revision as of 22:26, 21 March 2016 by Bbecane (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Example Error Text

 Syntax error at line 1 while checking:
 \[1, 2, 3]
    ^
 Index name expected in the index list for the reference operator.  The syntax is
   \[I, J, K]expr
 where I, J, K are the indexes to be consumed by the reference operator.  
 If you instead desire to take the reference of a literal list, surround the list with parentheses, e.g., \([1, 2, 3]).

Cause

As the error message indicates, the most likely reason for encountering this error is when you try to take the reference of a literal list. For example, perhaps you want a reference to the list [1, 2, 3], so you write:

\[1, 2, 3]

thinking, reasonably enough, that this will do it. The problem is that this the syntax for the reference takes an optional list of indexes after the backslash which, if specified, appear in brackets. So, the syntax for that is like this:

\[I, J, K]expr

This error is issued because your reference to a literal list looks just like this syntax. To actually obtain reference to a literal list, you have two ways to do this without a syntax that could get confused with \[I, J, K]expr, namely:

\([1, 2, 3])

or

var L := [1, 2, 3] do \L

See Also

Comments


You are not allowed to post comments.