ArraySet

In a one-dimensional array, sets the elements in a specified index range to a value.

Useful for initializing an array after a call to arrayNew.

Method Signature

ArraySet(array=[modifiablearray], start=[any], end=[any], value=[any])

Arguments

Argument
Type
Required
Description
Default

array

modifiablearray

true

The array to modify

start

any

true

The starting index

end

any

true

The ending index

value

any

true

Examples

Tag Syntax

<bx:set MyNewArray = arrayNew( 1 ) > 
<!--- ArrayToList does not function properly if the Array has not been initialized with arraySet. ---> 
<bx:set temp = <!--- Transpiler workaround for BIF return type --->(( <bx:argument>, <bx:argument>, <bx:argument>, <bx:argument> ) => <bx:set arraySet( arg1, arg2, arg3, arg4 ) ><bx:return true>)( MyNewArray, 1, 6, "Initial Value" ) > 
<bx:output>#ArrayToList( myNewArray, ", " )#</bx:output>

Result: Initial Value, Initial Value, Initial Value, Initial Value, Initial Value, Initial Value

Additional Examples

Run Example

newArray = arrayNew( 1 );
arraySet( newArray, 1, 4, "All is well" );
dump( newArray );
// member function
newArray.set( 1, 2, "lets change it" );
dump( newArray );

Last updated

Was this helpful?