This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-08-22 14:26:51

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

World arrays? HOW DO I?

My question is how do I make a world array?
Also, how do you make an array? Is this the right code?

Code:

x := Array new: 20 !

i want to know. I  used to, but I forgot. I haven't done something like this in a while.


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

#2 2011-08-22 14:56:42

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: World arrays? HOW DO I?

First off, do you really want to use an array?  The only thing I find useful in arrays is the sort command.  Besides that, I prefer OrderedCollections, since you can add and remove elements easily.

For an ordered collection, use
| t1 |
t1 _ #() asOrderedCollection.

If you really want an array, use
x := Array new: 20.

Last edited by Greenatic (2011-08-22 14:57:01)

Offline

 

#3 2011-08-22 15:07:05

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: World arrays? HOW DO I?

Greenatic wrote:

First off, do you really want to use an array?  The only thing I find useful in arrays is the sort command.  Besides that, I prefer OrderedCollections, since you can add and remove elements easily.

For an ordered collection, use
| t1 |
t1 _ #() asOrderedCollection.

If you really want an array, use
x := Array new: 20.

Thanks. I can just make an array into a global variable. And yes, I really want arrays, I understand them better. I'm creating a code for WindowsExplorer fo a custum CYOB thingy of a bopper. Anyway, Thanks.


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

Board footer