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

#1 2011-09-14 17:58:10

cycomachead
New Scratcher
Registered: 2011-09-07
Posts: 5

Extendable if Else Blocks

I think it'd be great if we could some how easily extend our if else blocks to have a potentially unlimited number of else statements without having to re-drag if-else onto itself a bunch of times. I was thinning there could be just an "else" block which would only attach to an if or if else and keep going, or you could have a new if-else block which would accept an argument for the number of else options, with a default to 1.

Offline

 

#2 2011-09-14 18:00:10

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Extendable if Else Blocks

An “else” block would confuse some Scratchers.

I don’t think we need this though because of the “if” block being compatible with the “not” block.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#3 2011-09-14 20:24:37

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Extendable if Else Blocks

I think you mean something like the "elif" statement in Python or the "switch" statement in Java? I've seen a suggestion like this before, and I still completely support the idea.  smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#4 2011-09-14 21:01:26

cycomachead
New Scratcher
Registered: 2011-09-07
Posts: 5

Re: Extendable if Else Blocks

Yeah, and elif or elseif statement. (Depends on the language, and I haven't learned photon yet…)

I do agree that just an else block could be confusing, so that's probably not the best idea, but some way to keep else if type statements more inline would make long programs more clear I think.  smile

Offline

 

#5 2011-09-15 10:37:49

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Extendable if Else Blocks

http://suggest.scratch.mit.edu/forums/6 … case-block
but you can't vote until you are a scratcher  sad

Offline

 

Board footer