Discuss Scratch

frdsaw
Scratcher
7 posts

Elif (else-if) block

I suggest adding an Elif (else-if) Block so you don't have to have numerous else and if blocks. I also suggest, with this, that you can change the elif amount ( making it changeable by length through numbers as part of the elif block.).
I hope you take this into account, as I would find it very useful.

(Feels like a speech! XD)

Check me out!
if <(frdsaw) = [EPIC!]> then
wait (0) secs
forever
PARTY!!!
end
end
AonymousGuy
Scratcher
1000+ posts

Elif (else-if) block

What would this look like? Would it be multiple ifs part of one block?
mathfreak231
Scratcher
1000+ posts

Elif (else-if) block

(sorry for abrupt edit but my opinions have changed and because i am one of the first few posters i need to look good)

Don't call it “elif”, just because it's used in Python doesn't mean the name won't be confusing.
The block (renamed) may just work but maybe it will be too cluttering with the “+”s? It's useful but will require reorganization…

Last edited by mathfreak231 (July 18, 2015 14:06:11)


i have grown as a person. and ive grown, literally. none of my posts from before 2022 represent me accurately.
turkey3_test
Scratcher
1000+ posts

Elif (else-if) block

when gf clicked
else
if (condition)

ProdigyZeta7
Scratcher
1000+ posts

Elif (else-if) block

if <>
else <>
else <>
end
Ah, there we go.

So how would this be made, exactly? Would there be (+) at the bottom part of the loop so when it's clicked the above happens? I support.



jontmy00
Scratcher
500+ posts

Elif (else-if) block

I support, and ProdigyZeta7, that would actually be quite a useful feature!

It'd be nice if there were a feature like that for “and”, “or”, and so on sort of blocks.
frdsaw
Scratcher
7 posts

Elif (else-if) block

How do I do a model of the block?

Check me out!
if <(frdsaw) = [EPIC!]> then
wait (0) secs
forever
PARTY!!!
end
end
scimonster
Scratcher
1000+ posts

Elif (else-if) block

mathfreak231 wrote:

First of all, nobody calls it Elif. It's “elseif” or “else if”.
Python users do, as that's the name of the Python keyword.

What's wrong with simply stacking if/elses?
if <...> then
...
else
if <...> then
...
else
if <...> then
...
else
if <...> then
...
else
...

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
gravtest
Scratcher
100+ posts

Elif (else-if) block

mathfreak231 wrote:

First of all, nobody calls it Elif
Python, C?

Sci's right, as always

mathfreak231
Scratcher
1000+ posts

Elif (else-if) block

scimonster wrote:

mathfreak231 wrote:

First of all, nobody calls it Elif. It's “elseif” or “else if”.
Python users do, as that's the name of the Python keyword.
Oh. Well I've never seen it before in Python (probably because I barely read Python or many other scripting languages at all; I'm a Lua person because I'm a Robloxian).

i have grown as a person. and ive grown, literally. none of my posts from before 2022 represent me accurately.
frdsaw
Scratcher
7 posts

Elif (else-if) block

if <>
else <>
else<+> <->
end

This, but with the second to last “else” to be “elif”, and the last else to be removed, also the + and - to be buttons.

Last edited by frdsaw (Dec. 4, 2013 16:45:25)


Check me out!
if <(frdsaw) = [EPIC!]> then
wait (0) secs
forever
PARTY!!!
end
end
AonymousGuy
Scratcher
1000+ posts

Elif (else-if) block

oh, elseif. I'm not very smart!

Yes, I think this could be a good idea.
cwrivera99
Scratcher
500+ posts

Elif (else-if) block

ProdigyZeta7 wrote:

if <>
else <>
else <>
end
Ah, there we go.

So how would this be made, exactly? Would there be (+) at the bottom part of the loop so when it's clicked the above happens? I support.
If < > Then

Else
If < > Then

Else

Last edited by cwrivera99 (Dec. 6, 2013 18:43:09)


when this block is clicked::sensing hat//FYI, this is my old account that I no longer use. My current account is @DaSpudLord.
forever {do (a [scratch v]::events ring)::sound}::extension cstart
say [what the...?] in (the language of [the moon people v]::red)::control
create [spontaneous v] explosion in [a flea's stomach]::motion
That's not right...::cend
If you are reading this… Then congratulations! You have found the part of my signature that was eaten by a kumquat! (On a side note, you are probably in a kumquat's stomach.) Now get out of the kumquat's stomach and go do something productive with your life. Like playing this game over and over again. Very productive.
lucs100
Scratcher
10 posts

Elif (else-if) block

scimonster wrote:

mathfreak231 wrote:

First of all, nobody calls it Elif. It's “elseif” or “else if”.
Python users do, as that's the name of the Python keyword.

What's wrong with simply stacking if/elses?
if <...> then
...
else
if <...> then
...
else
if <...> then
...
else
if <...> then
...
else
...

Well, in this Project that I made, using that many else / if blocks was extremely annoying and painstaking. To give the user more chances before crashing (see inside the project) would make it 12 or more else / if blocks thick!

(Scratch)= amazing

if <(Scratch)= amazing> then
forever
use Scratch
end

end

Tymewalk
Scratcher
1000+ posts

Elif (else-if) block

I play around with programming languages other than Scratch a little, and I notice they have something Scratch doesn't have - an else-if block.
For example, this example code uses elseif:

if (thing) {
do stuff
} else if (other thing) {
do other stuff
} else {
more stuff
}

I think this could be included in the if-else block by adding two arrows button on the side of the block, like some other blocks in Snap! have, to add an else if. I see that you can already do this with nested if-else blocks, but that gets really messy and confusing quickly. Here is what I am talking about by “nested if-else”:
if <condition> then
some stuff
else
if <condition2> then
do other stuff

end

end

Zebra coloring would not be added, because the if/else if/else will be one big block, like this:
if <> then
example
else if <> :: celse
another example
else if <> :: celse
more stuff
else
yet another example
end
People who think this is a good idea (AKA Supporters):
Tymewalk (That's me! Wait, don't I already support my own idea?)
MathlyCat
JamesOuO
cwkethan1508
liam48D
theonlygusti
IronBit_Studios
Nether_before
Vetpetmon
A-no-meep
chuckdaboss
Gaza101
pokejafe
PotOfGold

14 supporters

Semi-supporters:

stickfiregames
matey1234
Invisibowl

Who else thinks this is a good idea?

Last edited by Tymewalk (July 2, 2015 20:43:55)


bold thing - italic thing - underlined thing - strikethrough thing
DaSpudLord
Scratcher
1000+ posts

Elif (else-if) block

I think this is what you want-
if <> then

else if <> then :: celse

else

end
No support. Easy workaround-
if <> then

else
if <> then

else

end
end


U^ェ^U::motion//This is Blocky. He lives in my signature. He is a trained attack block. He protects my siggy from kumquats.
Tymewalk
Scratcher
1000+ posts

Elif (else-if) block

DaSpudLord wrote:

I think this is what you want-
if <> then

else if <> then :: celse

else

end
No support. Easy workaround-
if <> then

else
if <> then

else

end
end

Yes, that is what I want. I'm trying to get it added into Scratch. By “no support” you mean that the block can't be added to the editor by the Scratch team?

Last edited by Tymewalk (May 21, 2015 21:11:56)


bold thing - italic thing - underlined thing - strikethrough thing
Birdlegs
Scratcher
1000+ posts

Elif (else-if) block

No support means he doesn't think it's a good idea. Honestly, I don't like the system we use around here. “No support” always comes off sounding way more harsh than it should. If I don't think Scratch should have something, I simply explain why I think that. And I can see where this would be handy if you were getting really cluttered

Get a sweet lick of my new game right here! It's a tasty one!
ChocolatePi
Scratcher
1000+ posts

Elif (else-if) block

Other languages (other than Python, ick) don't have this feature. Using an “else if” conditional would be the same as doing else then a line break then an if. I don't think Scratch needs this, although I would like a switch structure.
MathlyCat
Scratcher
1000+ posts

Elif (else-if) block

JoeyTheChicken wrote:

No support means he doesn't think it's a good idea. Honestly, I don't like the system we use around here. “No support” always comes off sounding way more harsh than it should. If I don't think Scratch should have something, I simply explain why I think that. And I can see where this would be handy if you were getting really cluttered
Instant suggestion! (just gonna point that out)

Sounds very helpful, it would also make your code less messy, seems to me lots more pros, Support!

Think before you act.
Actions speek louder than words.

hi there fella

Powered by DjangoBB