For the complete documentation index, see llms.txt. This page is also available as Markdown.

ArrayNew

Create a new array.

Method Signature

ArrayNew(dimensions=[integer], isSynchronized=[boolean])

Arguments

Argument
Type
Required
Description
Default

dimensions

integer

false

The dimension of the array to create (currently only 1 is supported).

1

isSynchronized

boolean

false

Whether the array should be thread-safe (synchronized). Default is false.

true

Examples

Create the One dimensional array

Uses the arrayNew function to create the new array

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

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

Create unsynchronized array

Uses the arrayNew function to create the new unsynchronized array

Result: ["one"]

Create an array using implicit notation

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

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

Last updated

Was this helpful?