Siebel eScript Language Reference > Methods Reference > Array Methods >

About Array Functions


You use the following operator and an array function to create an array:

new

Table 29 describes different ways that you can use the array function.

Table 29. Example Usage of the Array Function
Example Array Function
Description

var a = new Array();an

This code initializes the following variable as an array with no elements:

a

The parentheses are optional.

var b = new Array(31);

This code creates an array that includes 31 array elements. If you must create an array that includes a predefined number of array elements, then you can use the number of elements as a argument of the Array function when you declare the array.

var c = new Array(5, 4, 3, 2, 1, "blast off");

This code creates an array that includes six elements:

  • c[0] is set to 5.
  • c[1] is set to 4.
  • And so on up to c[5], which is set to the string "blast off".

The first element of the array is c[0]. It is not c[1].

You can write code that passes elements to the Array function, which creates an array that contains the arguments that your code passes.

You can write code that creates an array dynamically. If you write code that uses an index in brackets to reference a variable, then the variable becomes an array. If you use this technique to create an array, then you cannot use the methods and properties with an associative array.

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.