User-Defined Variable Initialization

To declare and initialize variables in one step, use the following format:

Local String &MyString = "New";
Local Date &MyDate = %Date;

This method is available only for variables with the scope of Local.

Though you can declare more than one variable on a single line, you can only initialize one variable on a line. The following code creates a syntax error when you try to save the program:

Local Number &N1, &N2 = 5;

You cannot declare a variable, then initialize it in a second declaration statement. The following produces a duplicate declaration error when you try to save the program:

Global Number &N1; 
... 
Local String &N1 = "Str";  /* Duplicate definition. */

If you do not initialize variables, either when you declare them or before you use them, strings are initialized as Null strings, dates and times as Null, and numbers as zero.