githubEdit

ArrayNew

Return new array

Method Signature

ArrayNew()

Arguments

This function does not accept any arguments

Examples

Create the One dimensional array

Uses the arrayNew function to create the new array

Run Examplearrow-up-right

newArray = arrayNew( 1 );
someArray =
// Transpiler workaround for BIF return type
(( arg1, arg2, arg3, arg4 ) => {
	arraySet( arg1, arg2, arg3, arg4 );
	return true;
})( newArray, 1, 4, "All is well" );
writeOutput( JSONSerialize( newArray ) );

Result: ["All is well", "All is well", "All is well", "All is well"]

Create the Two dimensional array

Uses the arrayNew function to create the new array

Run Examplearrow-up-right

Result: [["First value", "First value"],["Second value", "Second value"]]

Create unsynchronized array

Uses the arrayNew function to create the new unsynchronized array

Run Examplearrow-up-right

Result: ["one"]

Create an array using implicit notation

Instead of using arrayNew you can also create an array using square brackets.

Run Examplearrow-up-right

Result: ["one", "two"]

Create an array with data type

When using data types on array creation, items are converted if possible, otherwise an error is thrown.

Result: [[true,true,true,true,null,true],[true,"true",1,"1",null,"yes"]]

Additional Examples

Run Examplearrow-up-right

Last updated

Was this helpful?