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

#26 2010-09-07 17:19:31

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: .:Squeak:.

ThePCKid wrote:

Found an error in one of your examples!
Original:

Code:

| condition |
condition := 10 > 3 + 4. "=> true"
condition
    ifTrue: [
        Transcript show: '10 > 7. That's good.']
    ifFalse: [
        Transcript show: 'I think something's wrong....'].
[Sensor anyButtonPressed] whileFalse: [
    World displayWorldSafely].

Fixed:

Code:

| condition |
condition := 10 > (3 + 4). "=> true"
condition
    ifTrue: [
        Transcript show: '10 > 7. That''s good.']
    ifFalse: [
        Transcript show: 'I think something''s wrong....'].
[Sensor anyButtonPressed] whileFalse: [
    World displayWorldSafely].

You forgot to escape the apostrophe. You also forgot something else.

Thanks!


nXIII

Offline

 

#27 2010-09-10 18:31:02

bendad
Scratcher
Registered: 2008-06-14
Posts: 100+

Re: .:Squeak:.

this really derserves a bump. so, BUMP


Hi!  big_smile
Good to see you. (Even if I don't know you  wink  )

Offline

 

#28 2010-09-14 18:05:01

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .:Squeak:.

Is Squeak slow?
Open a workspace and paste this in:

Code:

Smalltalk garbageCollect.
Smalltalk cleanUp

Now doIt.

Offline

 

#29 2010-09-14 18:49:54

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .:Squeak:.

FOR NEWBIES:
These two expressions almost do the same thing:

[Sensor anyButtonPressed] whileTrue: [World displayWorldSafely]

[Sensor anyButtonPressed] whileFalse: [World displayWorldSafely]

They both wait for a mouse button to be pressed. Here's the difference: the first one "resumes" Squeak right when the mouse button is pressed, while the second one "resumes" Squeak after the mouse button is released. Try them both by opening a workspace, pasting one of the codes in, "doingIt", and clicking on the background will show you the difference.

Offline

 

#30 2010-09-14 19:17:48

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: .:Squeak:.

ThePCKid wrote:

FOR NEWBIES:
These two expressions almost do the same thing:

[Sensor anyButtonPressed] whileTrue: [World displayWorldSafely]

[Sensor anyButtonPressed] whileFalse: [World displayWorldSafely]

They both wait for a mouse button to be pressed. Here's the difference: the first one "resumes" Squeak right when the mouse button is pressed, while the second one "resumes" Squeak after the mouse button is released. Try them both by opening a workspace, pasting one of the codes in, "doingIt", and clicking on the background will show you the difference.

but [sensor anyButtonPressed] whileTrue: [] will only work if you already have the mouse button pressed.... (otherwise it just won't execute)


nXIII

Offline

 

#31 2010-09-14 19:31:00

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .:Squeak:.

nXIII wrote:

ThePCKid wrote:

FOR NEWBIES:
These two expressions almost do the same thing:

[Sensor anyButtonPressed] whileTrue: [World displayWorldSafely]

[Sensor anyButtonPressed] whileFalse: [World displayWorldSafely]

They both wait for a mouse button to be pressed. Here's the difference: the first one "resumes" Squeak right when the mouse button is pressed, while the second one "resumes" Squeak after the mouse button is released. Try them both by opening a workspace, pasting one of the codes in, "doingIt", and clicking on the background will show you the difference.

but [sensor anyButtonPressed] whileTrue: [] will only work if you already have the mouse button pressed.... (otherwise it just won't execute)

Oh. Now I see. Just tested this and you were right:

10000 factorial. "Wait about one second after I doIt'd this chunk of code so it would have time to see that the mouse button is no longer down"
[Sensor anyButtonPressed] whileTrue: [World displayWorldSafely] "Using 'whileFalse:' instead of 'whileTrue:' would make it wait for the mouse button"

I don't know why I added the comments  tongue

Offline

 

#32 2010-10-05 15:10:08

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: .:Squeak:.

Bump, because this topic is useful.


/* No comment */

Offline

 

#33 2010-10-06 16:23:43

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: .:Squeak:.

wow

Offline

 

#34 2010-11-08 17:56:15

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: .:Squeak:.

Smalltalk has not been used for big applications since the 80's.
I am a bit fuzzy on why Scratch was written in "The Latin of programming languages" but I have heard that it is because scratch is supposed to be simple to learn. How can writing an application in a dead language make it easier to learn?  tongue
thanks for the tutorial. There are not many good smalltalk tutorials on the internet! Yours is great!


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#35 2010-11-09 15:52:00

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: .:Squeak:.

midnightleopard wrote:

Smalltalk has not been used for big applications since the 80's.
I am a bit fuzzy on why Scratch was written in "The Latin of programming languages" but I have heard that it is because scratch is supposed to be simple to learn. How can writing an application in a dead language make it easier to learn?  tongue
thanks for the tutorial. There are not many good smalltalk tutorials on the internet! Yours is great!

Thanks! I'm glad you liked my tutorial!  big_smile

Last edited by nXIII (2010-11-09 15:52:24)


nXIII

Offline

 

#36 2011-10-23 11:56:17

cocolover76
Scratcher
Registered: 2011-10-09
Posts: 500+

Re: .:Squeak:.

Do you know how to fix my Squeak VM?
See http://scratch.mit.edu/forums/viewtopic.php?pid=968840


http://i.imgur.com/HfEPZ.gifhttp://i.imgur.com/pvKb6.png

Offline

 

#37 2011-12-23 09:08:49

jurk
Scratcher
Registered: 2010-05-06
Posts: 100+

Re: .:Squeak:.

this is the best  big_smile


http://dl.dropbox.com/u/54228408/cool.png

Offline

 

Board footer