Discuss Scratch

Malicondi
Scratcher
1000+ posts

Elif (else-if) block

The-Sushi-Cat wrote:

I suggested the ability to add more and it could go up to nine or something. You could remove it and any code inside would simply just be kicked out of that statement, but it wouldn't be deleted

Malicondi wrote:

but how would you extend the elifs?

Last edited by Malicondi (March 3, 2024 19:29:07)

The-Sushi-Cat
Scratcher
500+ posts

Elif (else-if) block

Malicondi wrote:

The-Sushi-Cat wrote:

I suggested the ability to add more and it could go up to nine or something. You could remove it and any code inside would simply just be kicked out of that statement, but it wouldn't be deleted

Malicondi wrote:

but how would you extend the elifs?
Lil' plus at the bottom of the block

Lmao statement was not the right word

Last edited by The-Sushi-Cat (March 3, 2024 19:41:00)

Malicondi
Scratcher
1000+ posts

Elif (else-if) block

The-Sushi-Cat wrote:

Malicondi wrote:

The-Sushi-Cat wrote:

I suggested the ability to add more and it could go up to nine or something. You could remove it and any code inside would simply just be kicked out of that statement, but it wouldn't be deleted

Malicondi wrote:

but how would you extend the elifs?
Lil' plus at the bottom of the statement
seems simple enought, support.
starlightsparker
Scratcher
1000+ posts

Elif (else-if) block

Bump
Sussycrewmate12
Scratcher
9 posts

Elif (else-if) block

Support because this would make most codes become a large mess of orange blocks a bit less, and also because I might as well because I supported a dupe.

Last edited by Sussycrewmate12 (March 7, 2024 17:15:46)

MagicCoder330
Scratcher
1000+ posts

Elif (else-if) block

dupes be rolling
MagentaDude1359
Scratcher
100+ posts

Elif (else-if) block

support, it can get real messy when using a ton of if-elses
StarSubject
Scratcher
70 posts

Elif (else-if) block

An else if block would look like this:
if <> then {

}elseif<>{
medians
Scratcher
1000+ posts

Elif (else-if) block

Bringing this topic up.
ihavenocluewhythisis
Scratcher
500+ 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
...

its too big
BringUpYourPost
Scratcher
500+ posts

Elif (else-if) block

This will encourage nesting, as a never nesting no support
jmdzti_0-0
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.
Support!

Would look like this
if <> then{

}else if <>{

}@delInput@addInput::control
Quantum1993
Scratcher
500+ posts

Elif (else-if) block

frdsaw wrote:

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)
Couldn't you just do this?

if <> then 



else
if <> then

end
end
starlightsparker
Scratcher
1000+ posts

Elif (else-if) block

Oh my god we get it
Yes, you can do that
but it stacks blocks and that becomes messy
ywc2
Scratcher
85 posts

Elif (else-if) block

Interesting, but it might confuse new users because it's unclear which way the code will go since there are multiple possible outputs, the standard if-else chain is simple to understand.
Quantum1993
Scratcher
500+ posts

Elif (else-if) block

starlightsparker wrote:

Oh my god we get it
Yes, you can do that
but it stacks blocks and that becomes messy
I agree with @ywc2. This would be confusing to most users.
scratchyGabby6
Scratcher
100+ posts

Elif (else-if) block

BringUpYourPost wrote:

This will encourage nesting, as a never nesting no support
it's the opposite as without this block it would look like this:
if <> then 

else
if <> then

else
if <> then

else
if <> then

else
if <> then

else
if <> then

else

end
end
end
end
end
end
but with the elseif block, it would look like this:
if <> then {

} else if <> then @delInput {

} else if <> then @delInput {

} else if <> then @delInput {

} else if <> then @delInput {

} else if <> then @delInput {

} else {

} @addInput :: control
where the backward arrow removes the corresponding “else if” statement and the front facing arrow adds an “else if” statement
Davido2210
Scratcher
27 posts

Elif (else-if) block

Tymewalk wrote:

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?
Me
BigNate469
Scratcher
1000+ posts

Elif (else-if) block

I support. I don't like nesting so many if-then-else blocks.
Also, this is already a feature in most other Blockly-based programming languages, why not add it to Scratch?
ihavenocluewhythisis
Scratcher
500+ posts

Elif (else-if) block

frdsaw wrote:

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)

heres a elif just because

if <> is true then {code} else if <> is true {more code} else{even more code} [else = true v]+ - :: control

Last edited by ihavenocluewhythisis (May 14, 2024 20:47:25)

Powered by DjangoBB