Discuss Scratch

WallydogChoppychop
Scratcher
500+ posts

Elif (else-if) block

-1

The workaround is to easy I don't think it is useful enough to be added.
if <> then 



else
if <> then

end
end
jmdzti_0-0
Scratcher
1000+ posts

Elif (else-if) block

WallydogChoppychop wrote:

-1

The workaround is to easy I don't think it is useful enough to be added.
if <> then 



else
if <> then

end
end
At most you can ±0 or +1, but you can't subtract supporters, that's just… not how it works.
—————————————————————————————————————————
It may be messy, so maybe copy λSnap!'s idea to do this:
if <...::grey> then{
stuff::grey
}else if<...::grey>{
more stuff::grey
}@delInput@addInput::control
jmdzti_0-0
Scratcher
1000+ posts

Elif (else-if) block

Pengufenhoffer wrote:

ihavenocluewhythisis wrote:

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

What if we could make switch statements in scratch? As in java.
switch() {
case 1:
does_something;
case 2:
does_something_else;
case 3:
does_something_completely _different;
default:
does_something_significantly_less_exciting;
}
No support for that. Doing that is kinda mixing too much ingridients in the pot, keep it to blocks, as this is a begginer language.
Pengufenhoffer
Scratcher
100+ posts

Elif (else-if) block

jmdzti_0-0 wrote:

Pengufenhoffer wrote:

ihavenocluewhythisis wrote:

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

What if we could make switch statements in scratch? As in java.
switch() {
case 1:
does_something;
case 2:
does_something_else;
case 3:
does_something_completely _different;
default:
does_something_significantly_less_exciting;
}
No support for that. Doing that is kinda mixing too much ingridients in the pot, keep it to blocks, as this is a begginer language.

I'm also talking about blocks, surely there's an effective and educational way of integrating switch statements into block programming
ihavenocluewhythisis
Scratcher
500+ posts

Elif (else-if) block

WallydogChoppychop wrote:

-1

The workaround is to easy I don't think it is useful enough to be added.
if <> then 



else
if <> then

end
end
B R U H. I think everyone should stop posting that

Last edited by ihavenocluewhythisis (June 10, 2024 21:01:56)

medians
Scratcher
1000+ posts

Elif (else-if) block

WallydogChoppychop wrote:

-1

The workaround is to easy I don't think it is useful enough to be added.
This is meant for cleanup so you don't have to do that..
ihavenocluewhythisis
Scratcher
500+ posts

Elif (else-if) block

MushroomMan99 wrote:

No support.

Scratch keeps things simple by limiting the number of blocks. Adding an unnecessary block with an easy workaround does not really help anyone.
else if would be simple and they COULD remove the
if <> then 



else

end
for else if block
starlightsparker
Scratcher
1000+ posts

Elif (else-if) block

iiucandyfloss wrote:

You can use this:

if <not <something something>> then
do something something
end

Or you can stack if elses.

Problem solved. Messy, yes, but aesthetics are not the main focus of coding. They are not the focus of coding in any sense.
The issue with messy isn’t aesthetics. It’s that it becomes crowded and irritating to look at, could also potentially trigger people with ocd.
ajskateboarder
Scratcher
1000+ posts

Elif (else-if) block

iiucandyfloss wrote:

You can use this:

if <not <something something>> then
do something something
end

Or you can stack if elses.

Problem solved. Messy, yes, but aesthetics are not the main focus of coding. They are not the focus of coding in any sense.
This is probably some kind of logical fallacy, but why would all major languages in existence add an “else if” construct if it were solely for aesthetics? This construct doesn't make anything more complicated - it keeps your logic flat so you don't have to go through multiple levels of reading and it reads far more naturally compared to chained if else blocks

Last edited by ajskateboarder (June 10, 2024 22:41:45)

co0lcr34t10ns
Scratcher
1000+ posts

Elif (else-if) block

I'm teetering on the edge of support. I do find that the progressive horizontal growth gets annoying. But you kinda get used to it, plus it doesn't really make it that much harder to read.
scratchyGabby6
Scratcher
100+ posts

Elif (else-if) block

EVERYONE! STOP USING THIS AS AN EXAMPLE MOCKUP

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?
scratchyGabby6
Scratcher
100+ posts

Elif (else-if) block

jmdzti_0-0 wrote:

WallydogChoppychop wrote:

-1

The workaround is to easy I don't think it is useful enough to be added.
if <> then 



else
if <> then

end
end
At most you can ±0 or +1, but you can't subtract supporters, that's just… not how it works.
—————————————————————————————————————————
It may be messy, so maybe copy λSnap!'s idea to do this:
if <...::grey> then{
stuff::grey
}else if<...::grey>{
more stuff::grey
}@delInput@addInput::control
Yeah!
Foldy_TPOT
Scratcher
100+ posts

Elif (else-if) block

AonymousGuy wrote:

What would this look like? Would it be multiple ifs part of one block?
else if <>{




}::control
without an if block attached, and with:
if <> then{

}else if <>{




}::control
ihavenocluewhythisis
Scratcher
500+ posts

Elif (else-if) block

Birdlegs wrote:

ChocolatePi wrote:

I mean, it can get very messy, but without an expander retractor thing I'm just gonna have to not support this idea.
Maybe something like this:
if () then

else, if () then + ::celse // The "+" would put another else if after this one but before the "else"

else :: celse

end
We'd have to be able to subtract them too… That could make the block look ugly. Perhaps the plus and minus would only appear when you moused over the block. However, that could mean some extra lag in the project editor, constantly checking for mouse contact just for that. Perhaps you could just add/subtract to/from “if/else” in the right-click menu.

if <> then {
} else if <> {
} else {
} (+::operators) (-::) :: control

Last edited by ihavenocluewhythisis (Nov. 27, 2024 19:53:50)

abdavark
Scratcher
500+ posts

Elif (else-if) block

if <...::#bbbbbb> then 
...
else
if <...::#bbbbbb> then
...
else
...
end
end
mcsquaggle
Scratcher
500+ posts

Elif (else-if) block

support!
it's really useful.
although i wouldn't call it “elif” just because python calls it that. it would be confusing for newer users if it was called elif.
and for the whole block clutter, and having 3 if blocks:
condense if else, if, and if else if blocks into one.
if <> then{

}end@addInput ::control
ihavenocluewhythisis
Scratcher
500+ posts

Elif (else-if) block

abdavark wrote:

if <...::#bbbbbb> then 
...
else
if <...::#bbbbbb> then
...
else
...
end
end
this explains why that doesn't work
ihavenocluewhythisis
Scratcher
500+ posts

Elif (else-if) block

bump
MillionOfficial
Scratcher
500+ posts

Elif (else-if) block

Support, because the workaround is BIG:
if <> then 
if <> then
if <> then
if <> then
if <> then
if <> then
if <> then
if <> then



else

end



else

end


else

end


else

end


else

end


else

end


else

end


else

end
Also, here’s a mockup:
if <> then {

} else if <> then{

} (+::grey) (-::grey) :: control
medians
Scratcher
1000+ posts

Elif (else-if) block

Bringing this topic up.

Powered by DjangoBB