Programming Guide : Working with Arrays, Table Fields, and Collections : Arrays : How You Can Declare an Array
 
Share this page          
How You Can Declare an Array
If the array variable is not associated with a table field, you must declare it in your application before you can reference the variable (or its component parts) in the 4GL code. The syntax for declaring an array variable is:
arrayname = array of classname [default null]
The class can be any system class or user class. The following statement declares an array of user class VIDEO_ROW. The video_list reference variable defaults to null:
video_list = array of VIDEO_ROW default null;
If the array's class is not known until runtime, declare the type of the array to be Object. For an example of using an array generically, see How You Can Sort Table Field Data Generically. For more information about specifying the default null clause, see How You Can Reference Objects.
Declaring an array variable does not place any actual rows into the array; instead, it:
Specifies the type of object that is to comprise the array
Initializes an object of type ArrayObject that contains a description of the array and provides access to methods for manipulating the array (if it is not declared with default null)
For more information about these methods, see How You Can Manipulate Arrays.