Difference between revisions of "Array SetMaxIndex"
Jump to navigation
Jump to search
(Created page with "Resizes a declared dynamic array to a specified number of elements; returns a value of True to indicate a successful resize. An array can be resized to a larger or to a s...") |
|||
Line 2: | Line 2: | ||
An array can be resized to a larger or to a smaller number of elements; any elements added to an array will be assigned the initial value that was specified at array declaration. | An array can be resized to a larger or to a smaller number of elements; any elements added to an array will be assigned the initial value that was specified at array declaration. | ||
− | + | == Usage == | |
<syntaxhighlight>Array_SetMaxIndex(ArrayName,MaxIndex)</syntaxhighlight> | <syntaxhighlight>Array_SetMaxIndex(ArrayName,MaxIndex)</syntaxhighlight> | ||
− | Where: | + | Where: |
+ | :'''ArrayName''' - an expression specifying the name of an array to be resized | ||
− | + | :'''MaxIndex''' - a numerical expression specifying the maximum index of the array* | |
[[*]]Array indexes start at 0, and array size is equal to the value of MaxIndex plus one. | [[*]]Array indexes start at 0, and array size is equal to the value of MaxIndex plus one. | ||
− | + | == Return == | |
[[True]] - resize sucessfull | [[True]] - resize sucessfull | ||
[[False]] - resize failed | [[False]] - resize failed | ||
− | + | == Example == | |
Resize the dynamic array Array1 to 10 elements by specifying a maximum index value of 9: | Resize the dynamic array Array1 to 10 elements by specifying a maximum index value of 9: | ||
Latest revision as of 21:29, 27 February 2017
Resizes a declared dynamic array to a specified number of elements; returns a value of True to indicate a successful resize. An array can be resized to a larger or to a smaller number of elements; any elements added to an array will be assigned the initial value that was specified at array declaration.
Usage
Array_SetMaxIndex(ArrayName,MaxIndex)
Where:
- ArrayName - an expression specifying the name of an array to be resized
- MaxIndex - a numerical expression specifying the maximum index of the array*
*Array indexes start at 0, and array size is equal to the value of MaxIndex plus one.
Return
True - resize sucessfull
False - resize failed
Example
Resize the dynamic array Array1 to 10 elements by specifying a maximum index value of 9:
Array_SetMaxIndex(Array1,9);
Assign a value that indicates a status of the resize of Array1 to the ResizeReport variable:
ResizeReport=Array_SetMaxIndex(Array1,9);
A value of True will indicate a successful resize, and a value of False will indicate a failed resize.