PDA

View Full Version : when making variables, what is the LIST/ARRAY?


hydude777
02-20-2012, 06:31 AM
what are those? how do I use them?

TauTrumpsPi
02-20-2012, 10:32 AM
A list is a group of variables that you can perform actions all at once with, or change them seperately, or independently, or whatever.

Say you had a group of 15 rabbits, and you wanted them all to move forward at once. You could do it by putting the movement commands in a do together, but that takes a while, and if you have more things for the rabbits to do it will take forever. That's where lists come in handy

Make a list of the rabbits, and then drag in "For all together" and have Items_From_Rabbits move forward, and you have now accomplished in one line of code what used to take 15. You can also use the "for all in order" to make them do the movement in order of the list, but that is more useful for checking something, say if you wanted to see if any of the rabbits were within 5 meters of the goal or whatnot, you could check them one by one that way.

That's lists. I learned arrays once upon a time, but I never used them, so I kind of forgot them.:(