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

#1 2007-05-25 02:00:10

PatternsOfChaos
Scratcher
Registered: 2007-05-25
Posts: 13

Switch, or If Else Else

Something I would very much like to see:

Some means to test for more than one possibility

Right now, I am testing for a variable between 1-4, and there is no simple construct for this, other than just stringing a bunch of IF's together.

Offline

 

#2 2007-05-25 07:35:13

Roberth
Scratcher
Registered: 2007-05-15
Posts: 46

Re: Switch, or If Else Else

Or to make it really ugly, a bunch of nested If..Else blocks.

I agree that a "Switch" or "Case" structures would be something worth adding to Scratch as an eventual improvement.  But the point at the moment is that you can work around this issue, even if it makes your script look ugly and hard to maintain.

I also think this is something that should be simple for kids to be able to understand as a rough concept.  For me, the block would look something like the If...else block with room for extentions.  The real trick would be to come up with how you would graphically add additional cases, although the "else case" is something that should be preserved as well.

And please, oh please, oh please, oh please do not implement it anything like unto a C switch statement with the necessary breaks and other such nonsense.  That to me has got to be the ugliest case selector in the history of software language design, where it was considered a feature.  And a source of far too many design bugs that never had to really be there in the first place.  C# improved on it slightly, but left the "break" stuff in the specification because too many C++ programmers were leaving the break in while they were coding and turned it into a mandatory feature instead of optional like ANSI C.

Offline

 

#3 2007-05-25 07:39:42

sunshine
Scratcher
Registered: 2007-05-25
Posts: 1

Re: Switch, or If Else Else

hi peeps only jus joined lol my fwend told me bout theis. gdgd
xsunshinx

Offline

 

#4 2007-05-27 23:30:59

PatternsOfChaos
Scratcher
Registered: 2007-05-25
Posts: 13

Re: Switch, or If Else Else

Hmm - I have a couple thoughts on the graphical representation for that - maybe I'll give it a go in photoshop & see what I can do...

I would agree that "break" should not be necessary in a Scratch Switch - given the goal, it does seem it would overcomplicate things.

Offline

 

Board footer