Moderator summary:
An array, or "list" as they're called in Scratch, is exactly what they sound like: a list of values, essentially a variable with several variables within them.
You can make lists in the "Variables" tab, and you can view their contents by clicking the checkbox next to their name in order to display the list on the stage.
I've never heard of 'em. someone explain please?
Last edited by demosthenes (2010-12-17 17:28:59)
Offline
Arrays are a type of variable. But instead of holding just one number, they can hold a whole lot of numbers. You tell it which number you want to work with by changing an index value. Here's an example using a language like Basic where we have an array called Size which is assigned some values:
Size(1) = 10
Size(2) = 15
Size(3) = 32
You can see that the name of the array, Size, stays the same but the index value changes from 1 to 2 to 3. The array is holding three numbers all at once. Arrays can hold lots of data - hundreds or thousands of values. And the data can be accessed easily in a loop, simply by changing the index value. In most languages, arrays can do more than just hold numbers; you can make arrays that hold words or other types of data. You can do some cool things with arrays.
Scratch is expected to have arrays in version 1.3 but they will probably look quite a bit different from what I have shown here. The basic idea, however, will be the same.
Offline
Paddle2See wrote:
Arrays are a type of variable. But instead of holding just one number, they can hold a whole lot of numbers. You tell it which number you want to work with by changing an index value. Here's an example using a language like Basic where we have an array called Size which is assigned some values:
Size(1) = 10
Size(2) = 15
Size(3) = 32
You can see that the name of the array, Size, stays the same but the index value changes from 1 to 2 to 3. The array is holding three numbers all at once. Arrays can hold lots of data - hundreds or thousands of values. And the data can be accessed easily in a loop, simply by changing the index value. In most languages, arrays can do more than just hold numbers; you can make arrays that hold words or other types of data. You can do some cool things with arrays.
Scratch is expected to have arrays in version 1.3 but they will probably look quite a bit different from what I have shown here. The basic idea, however, will be the same.
They are actually quite similar to what you said (I have the beta). Except that they're called lists. There's a variable display type thing which actually looks quite strange, but you can resize it and all. There are also a few blocks:
add [thing] to list (you can type or drag a variable as variables can be either text strings or numbers),
delete (all, first, last, or number) of list,
insert [thing] at (first, last, or number) of list,
replace (first, last, or number) of list with [thing],
then there are the variable blocks for the arrays.
item (1) of list
length of list
it's pretty easy to use, actually. when i first saw them, I thought I wouldn't understand them, but they're simpler than they look.
Offline
coolstuff wrote:
Paddle2See wrote:
Arrays are a type of variable. But instead of holding just one number, they can hold a whole lot of numbers. You tell it which number you want to work with by changing an index value. Here's an example using a language like Basic where we have an array called Size which is assigned some values:
Size(1) = 10
Size(2) = 15
Size(3) = 32
You can see that the name of the array, Size, stays the same but the index value changes from 1 to 2 to 3. The array is holding three numbers all at once. Arrays can hold lots of data - hundreds or thousands of values. And the data can be accessed easily in a loop, simply by changing the index value. In most languages, arrays can do more than just hold numbers; you can make arrays that hold words or other types of data. You can do some cool things with arrays.
Scratch is expected to have arrays in version 1.3 but they will probably look quite a bit different from what I have shown here. The basic idea, however, will be the same.They are actually quite similar to what you said (I have the beta). Except that they're called lists. There's a variable display type thing which actually looks quite strange, but you can resize it and all. There are also a few blocks:
add [thing] to list (you can type or drag a variable as variables can be either text strings or numbers),
delete (all, first, last, or number) of list,
insert [thing] at (first, last, or number) of list,
replace (first, last, or number) of list with [thing],
then there are the variable blocks for the arrays.
item (1) of list
length of list
it's pretty easy to use, actually. when i first saw them, I thought I wouldn't understand them, but they're simpler than they look.
Actually, I have the beta too and I've been working with it quite a bit. But the Scratch Team asked us to not discuss beta features on the forums as it might confuse people. Also, the final form might change before the official release - remember the Comment Block!
Offline
Does anyone know if you can add a sprite to a lsit and, if so, how do you do it?
Offline
Quaggledorf wrote:
Does anyone know if you can add a sprite to a lsit and, if so, how do you do it?
You can't, that's a feature of object-oriented programming that's taking its sweet time to get to Scratch. You can give each sprite a "name" variable and add that to a list, it might help you accomplish whatever you're trying to do.
Offline
thank you
Offline
To my way of thinking; An Array is a 2 Dimensional Block of Data...
And Scratch only has Lists, which are 1 Dimensional Lists of Data...
But--
The Items in Each Line of the List can be VERY BIG...
So that you can store a string of numbers as Characters in An Item on A List
Then use The Block (?) to Grab a Specific Item in that List
Then Use The String Block (?) to Grab a Specific Character in that String...
Effectively Creating a Viable Array...???
Offline
um... Can people stop necroposting? It's really annoying. I think this should be closed.
If you don't know what necroposting is, it's posting on a topic that has not been posted on in a long time.
Offline
TimeFreeze wrote:
um... Can people stop necroposting? It's really annoying. I think this should be closed.
If you don't know what necroposting is, it's posting on a topic that has not been posted on in a long time.
Well, someone might have a question or comment about arrays in the future, I don't believe there's a need to close this thread. Besides, the last few posts are within few days of each other (the big jump in time is from Quaggledorf's post to raywili's post), and it seems to have remained on topic.
Offline
oh yeah... Sorry.
Btw, I thought that P2S's post and Quaggledorf's post was the big jump.
Offline
TimeFreeze wrote:
oh yeah... Sorry.
Btw, I thought that P2S's post and Quaggledorf's post was the big jump.
I was referring to the last big time difference in posting (the one that could, in a sense, be qualified as the last necropost in this thread). And it's alright.
Offline