Site Tools


This shows you the differences between two versions of the page.

Link to this comparison view

developer:scriptsamples:redimmulti [2015/09/14] (current)
Line 1: Line 1:
 +======Resizing Multi-Dimensional Arrays======
 +> **Developer:​** //​[[developer:​rhinoscript|RhinoScript]]//​
 +> **Summary:​** //Discusses VBScript'​s ReDim statement and it usage with multi-dimensional arrays.//
 +===== Overview =====
 +The **ReDim** statement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). You can use the **ReDim** statement repeatedly to change the number of elements and dimensions in an array.
 +If you use the **Preserve** keyword, you can resize only the last array dimension, and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array.
 +The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array.
 +<code vb>
 +ReDim arr(10, 10, 10)
 +. . .
 +ReDim Preserve arr(10, 10, 15)
 +> **Caution**:​ If you make an array smaller than it was originally, data in the eliminated elements is lost.
 +{{tag>​Developer RhinoScript}}
developer/scriptsamples/redimmulti.txt ยท Last modified: 2015/09/14 (external edit)