Page 88 makes no sense to me... help

If I'm doing something wrong with this post, just let me know. First post.

So, I'm reading page 88 of the manual and it says the essentially an array of data is an array of methods. Kind of having a hard time accepting that or doing anything with it. A method is a function. An array of data elements is not an array of functions. i.e. - I can't store actual code in the array (or can I?)

Not seeing how the presentation pertains to methods. They're mentioned, but then it goes on to a keyed list of values, not methods. (based on what I think a method is - actual functional code.)

Am I reading too much into it?

actually, yes, you can store code in arrays and variables!
untitled script pic (2)
just use the grey blocks at the top of the "operators" tab!

Wow. Now THAT is interesting.

i made a project showing how to use them also!
just click on the project link and then press "see code" to see how it works!

Everything in snap is first class, remember that

Absolutley ANYTHING can be in a list, this includes costumes, sprites, and even sounds!

Ah! T
his proves the point very nicely.

I slowed it down with a wait0.5 at the end of the repeat block (Haven't figured out how to post pix of blocks yet)

You'll be able to soon (it's a new user restriction to keep away spam/scams/bots). Just keep reading the forums, and you'll be able to.

Also, to get the nice pictures of scripts, just right click the script and select script pic. If it's a reporter, you'll also have the option to get a result pic, which is a script pic, but it includes the result of the block (it runs the reporter then captures the picture).

This is also the best way to do it, because you can actually drag and drop these script pics into snap and get the script back (if it imports as a costume, you can right click the costume and select get blocks. If the option isn't there, and you got the image from the forum, just click the image (on the forum) to get the full size, then drag and drop the image into snap).

did you mean: result pic

Heh, yeah

Just to clarify this, page 88 doesn't say that every array of data is an array of methods. It just says that in the particular OOP implementation demonstrated in that section, we don't want every part of the program to have to ask "is this a method or is it something else?" So instead, if it's something else, we wrap a method around the something else and put that wrapper procedure in the array. So, every component of an object is treated as a method (an accessor method, if you speak that vocabulary).

PS Welcome to Snap!.

i just added an update to the project showing how to make it loop itself!

and other lists :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.