sparks wrote:
Pecola1, What are the square brackets in smalltalk code used for? I've always wondered. also, what are hashes used for? Such as #mouse and #edge above.
Square brackets are unevaluated code. So, "var ifNotNil: [var this]" will only make var do "this" if var is not nil. It is just like BYOB's "the script" block.
Offline
so are they like parenthesi in an equation? where the calculation deals with the result of what's in the parenthesi, not with the contents individually?
e.g. (I know this does not actually work)
setting t1 to 5 rather than 3+2
Offline
sparks wrote:
Pecola1, What are the square brackets in smalltalk code used for? I've always wondered. also, what are hashes used for? Such as #mouse and #edge above.
The hashes are like broadcast almost; it means that the computer will look for a code named whatever is after the #.
The [ and ] are (I am not really sure) Like for conditions such as ifTrue: [^ true].
(I thought you were an expert?)
Offline
LOL love your new signature sparks!
Offline
sparks wrote:
Me? no! I'm a beginner! I just pick bits of it up as I go along Why did you think I was an expert?
Panther.
(At least 60 seconds have to pass between posts. Please wait a little while and try posting again.)
Offline
I'm not Panther's programmer though, that's nXIII and a bit of MathWizz. I'm public relations, presentation, webmaster, and if we all worked in the same place, I'd probably make the tea too!
Offline
Pecola1 wrote:
sparks wrote:
Pecola1, What are the square brackets in smalltalk code used for? I've always wondered. also, what are hashes used for? Such as #mouse and #edge above.
The hashes are like broadcast almost; it means that the computer will look for a code named whatever is after the #.
The [ and ] are (I am not really sure) Like for conditions such as ifTrue: [^ true].
(I thought you were an expert?)
No, #selector is a selector. It is almost identical to a string.
sparks wrote:
I'm not Panther's programmer though, that's nXIII and a bit of MathWizz. I'm public relations, presentation, webmaster, and if we all worked in the same place, I'd probably make the tea too
Last edited by MathWizz (2010-12-24 13:53:50)
Offline
sparks wrote:
I'm not Panther's programmer though, that's nXIII and a bit of MathWizz. I'm public relations, presentation, webmaster, and if we all worked in the same place, I'd probably make the tea too!
LOL
Offline
sparks wrote:
What are example of a selector then? I'd love to know how to use them!
When making a list selector
yourListName
^ #('your first list insert' 'your second list insert' 'your third list insert' 'etc.' )
Offline
sparks wrote:
owetre, you need to supply an image of the blocks that make up your custom blocks! Also a link to a sprite containing the block for each block is appreciated.
glide to random XY and all but ( ) of [list] are already shared and touching mouse and clicked are already blocks!
I said I didn't post the scripts yet. The blocks that make up the blocks. I will do that now. I don't know how to put sprites up to download. My baby cousin came over, so I didn't have the time. I know how to post blocks. I have done it before.
Last edited by owetre18 (2010-12-24 18:27:15)
Offline
Offline
Merry Christmas, Happy Hanukkah, Happy K- Oh, forget it! Santa left you an early present. Here it is!
[===]
( > )
-----( )-----
( )
-----------
Snowman, if you didn't know or if it got messed up.
Offline
Pecola1 wrote:
sparks wrote:
What are example of a selector then? I'd love to know how to use them!
When making a list selector
yourListName
^ #('your first list insert' 'your second list insert' 'your third list insert' 'etc.' )
Oh! That's an array! #('test' '123') makes an array with items "test" and "123". I was talking about the #test. You can investigate these by opening the workspace, typing the command, selecting it, then pressing alt + i and an inspect widow will pop up. Try it with strings too!
Offline
Why are you never on Yahoo chat, sparks?
Offline
<when green flag clicked>
<if imagining and programming and sharing>
<go to BYOB>
<end>
Offline
Don't spend much time on yahoo I'm afraid, it keeps giving my browser "unresponsive script" messages that are quite annoying. I also have three email accounts so I'm not always on my Scratch one as yahoo won't let me sign in to two at once!
Offline
im imagining and programming!
Offline
sparks wrote:
Don't spend much time on yahoo I'm afraid, it keeps giving my browser "unresponsive script" messages that are quite annoying. I also have three email accounts so I'm not always on my Scratch one as yahoo won't let me sign in to two at once!
Do you have Firefox? Then try IE Tab and tell it to not sync cookies. If that doesn't work, try CookieSwap.
Offline
-----------NEW BLOCK-----------
i have made the (- ( ) ) block. it reports the negative of a number.
BLOCKSPEC:
('-%n' #r #negation:)
CODE:
negation: t1 ^ t1 * -1
Last edited by hello12345678910 (2010-12-26 08:58:39)
Offline
hello12345678910 wrote:
-----------NEW BLOCK-----------
i have made the (- ( ) ) block. it reports the negative of a number.
BLOCKSPEC:Code:
('-%n' #r #negation:)CODE:
Code:
negation: t1 ^ t1 * -1
That can be made perfectly with the existing blocks.
((join[-](number) + (0))[/blocks]
the +0 is so that it becomes an integer instead of a string
Offline
scimonster wrote:
hello12345678910 wrote:
-----------NEW BLOCK-----------
i have made the (- ( ) ) block. it reports the negative of a number.
BLOCKSPEC:Code:
('-%n' #r #negation:)CODE:
Code:
negation: t1 ^ t1 * -1That can be made perfectly with the existing blocks.
((join[-](number) + (0))[/blocks]
the +0 is so that it becomes an integer instead of a string
(0 - number) is better.
Offline