Set the capacity of a array to 3 elements in Pas2JS |
Top |
Result is: ---- 0 2 --------------- Note: Here we have defined a wishes array containing string elements. We use the SetLength routine to set the array size. Such arrays are called dynamic because their size is determined dynamically (at run time). The SetLength routine can be used to change the array size more than once - decresaing or increasing the size as desired. My wishes array (list) may indeed grow quite large over time.
* Using SetLength(wishes, 3), Pas2JS will give your an error : "Expected type String instead of Array of String".
JS output:
|