Page 1 of 1

Initiate Arrays, Lists, etc.

Posted: Nov 13th, '18, 01:03
by Calloway
Is there any set way to set a variable to an array of a certain size or a list of the same stature?
Or pretty much anything that isn't a string or number (for example, a table)

Re: Initiate Arrays, Lists, etc.

Posted: Jun 3rd, '19, 13:29
by JohnM
You can create a fixed size Array object with ten elements like this:

Code: Select all

print (newArray 10)
If you add a third parameter, the Array is filled with that value:

Code: Select all

print (newArray 10 'ha!')
Finally, you can turn an Array into a List like this:

Code: Select all

print (toList (newArray 10 'ho!'))

Re: Initiate Arrays, Lists, etc.

Posted: Jun 5th, '19, 19:00
by Calloway
Thank you again, although I don't understand why not just have a Initiate Array block?
But thanks to how you made GP it's as easy as just adding a few lines to the library and it's there so thank you for that too :D