ArrayClear

Clear all items from array

Method Signature

ArrayClear(array=[modifiableArray])

Arguments

Argument
Type
Required
Description
Default

array

modifiableArray

true

The array to clear.

Examples

Clear the value of an array

Uses the arrayClear function to clear the value of an array

Run Example

someArray = [ 
	"Red",
	"White",
	"Green",
	"Blue",
	"Pink"
];
writeOutput(
// Transpiler workaround for BIF return type
(( arg1 ) => {
	arrayClear( arg1 );
	return true;
})( someArray ) );

Result: Yes

Clear the value of an array

To clear the value of an array

Run Example

someArray = [ 
	"Red",
	"White",
	"Green",
	"Blue",
	"Pink"
];
writeOutput(
// Transpiler workaround for BIF return type
(( arg1 ) => {
	arrayClear( arg1 );
	return true;
})( someArray ) );

Result: true

Clear value of an array using member function

Uses the member function is the same as running arrayClear.

Run Example

numberArray = [ 
	1,
	2,
	3
];
writeOutput( numberArray.Clear() );

Result: Yes

Additional Examples

Run Example

// Creates an array containing 4 elements with the numbers 1 - 4.
numbers = [
	1,
	2,
	3,
	4
];
dump( numbers ); // outputs the array containing 1 - 4
// Clears the array leaving an array with 0 elements.
ArrayClear( numbers );
dump( numbers );
 // outputs the empty array

Last updated

Was this helpful?