ArrayResize

Resets an array to a specified minimum number of elements.

This can improve performance, if used to size an array to its expected maximum. For more than 500 elements, use arrayResize immediately after using the ArrayNew BIF.

Method Signature

ArrayResize(array=[modifiablearray], size=[any])

Arguments

Argument
Type
Required
Description
Default

array

modifiablearray

true

The array to resize

size

any

true

The new minimum size of the array

Examples

Tag Syntax

<bx:set MyArray = arrayNew( 1 ) > 
 <!--- Resize that array to the number of records in the query. ---> 
 <bx:set temp = <!--- Transpiler workaround for BIF return type --->(( <bx:argument>, <bx:argument> ) => <bx:set arrayResize( arg1, arg2 ) ><bx:return true>)( MyArray, 8 ) > 
  <bx:dump var="#MyArray#"/>  

Additional Examples

Run Example

numbers = [ 
	1,
	2,
	3,
	4
];
arrayResize( numbers, 10 );
Dump( numbers );
// member function
numbers.resize( 15 );
Dump( numbers );

Last updated

Was this helpful?