contents   index   previous   next



Automatic array allocation

 

Arrays are dynamic, and any index, positive or negative, into an array is always valid. If an element of an array is referenced, then ScriptEase ensures that such an element exists. For example, if a statement in a script is:

 

var foo[4] = 7;

 

then ScriptEase makes an array of 5 integers referenced by the variable foo. If a later statement refers to foo[6] then ScriptEase expands foo, if necessary, to ensure that the element foo[6] exists. The same is true for negative indices. When foo[10] is referenced, foo is grown in the negative direction if necessary, but foo[4] still refers to the initial 7. Arrays can be of any order of dimensions, thus foo[6][7][34][1][4] is a valid variable or array.

 


Automatic and JavaScript Arrays