Array declaration

Monkey Forums/Monkey Beginners/Array declaration

Yoda(Posted 2014) [#1]
If I want to put values into an array at runtime, and I want to put multiple values in the array, how can I do that?

I know I can use

bla=[1,2,3,4,5,6,7,8]

but when I want to add more values at the end, or change multiple values, is there something like

bla[8..12]=[9,10,11,12]

or can I only assign one value at a time, like

bla[8]=9
bla[9]=10
etc.

??


ziggy(Posted 2014) [#2]
Just one value at a time.


Samah(Posted 2014) [#3]
If you're using Diddy you could use the Arrays utility class.
Local bla:Int[] = [1,2,3,4,5,6,7,8]
' overwriting values
Arrays<Int>.Copy([9,10,11,12], 0, blah, 8, 4)
' joining arrays
bla = Arrays<Int>.Join(bla, [9,10,11,12])


https://code.google.com/p/diddy/source/browse/src/diddy/arrays.monkey