Error Messages/40123

< Error Messages
Revision as of 00:01, 5 January 2017 by Lchrisman (Talk | contribs) (Local Variables --> Local Values (terminology change))

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


Example error messages

 For x do u
       ^
 expecting :=

 Var x;
      ^
 expecting :=

 ^
 expecting :=

Cause

You have a syntax error in the declaration of a local value. When you declare a local value, you must specify its initial value.

If the snippet of expression shown in the dialog doesn't seem to have anything to do with a local variable declaration (or is blank), and the position of the error shown in the dialog is at the beginning of the line, it means you have a new-line following the name of your variable, e.g.:

  Var x

Or in this this case:

  Var x
  Sum(x + y, I)

you'd see:

  Sum(x + y, I)
  ^
  expected :=

That's because Analytica allows you to place whitespace anywhere in an expression, and the fact that the := is missing doesn't become evident until the line following the Var x declaration. Hence, the dialog displays the line following. In these cases, be sure to look at the line preceding, which will be a local variable declaration (Var..Do, For..Do, MetaVar..Do, LocalAlias..Do, etc.)

Remedy

In the For loop case, provide the set of values to iterate over, e.g.:

For x := I do u

In the declaration case, provide some initial value, even if it is just Null or 0, e.g.:

 Var x:= Null;
 ...

See Also

Comments


You are not allowed to post comments.