Discuss Scratch
- Discussion Forums
- » Suggestions
- » Elif (else-if) block
- 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.
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
-1At most you can ±0 or +1, but you can't subtract supporters, that's just… not how it works.
The workaround is to easy I don't think it is useful enough to be added.if <> then
else
if <> then
end
end
—————————————————————————————————————————
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
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.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;
}
- Pengufenhoffer
-
Scratcher
100+ posts
Elif (else-if) block
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.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;
}
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
-1B R U H. I think everyone should stop posting that
The workaround is to easy I don't think it is useful enough to be added.if <> then
else
if <> then
end
end
Last edited by ihavenocluewhythisis (June 10, 2024 21:01:56)
- medians
-
Scratcher
1000+ posts
Elif (else-if) block
-1This is meant for cleanup so you don't have to do that..
The workaround is to easy I don't think it is useful enough to be added.
- ihavenocluewhythisis
-
Scratcher
500+ posts
Elif (else-if) block
No support.else if would be simple and they COULD remove the
Scratch keeps things simple by limiting the number of blocks. Adding an unnecessary block with an easy workaround does not really help anyone.
if <> thenfor else if block
else
end
- starlightsparker
-
Scratcher
1000+ posts
Elif (else-if) block
You can use this: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.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.
- ajskateboarder
-
Scratcher
1000+ posts
Elif (else-if) block
You can use this: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 blocksif <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.
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
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 <> thenPeople who think this is a good idea (AKA Supporters):
example
else if <> :: celse
another example
else if <> :: celse
more stuff
else
yet another example
end
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
Yeah!-1At most you can ±0 or +1, but you can't subtract supporters, that's just… not how it works.
The workaround is to easy I don't think it is useful enough to be added.if <> then
else
if <> then
end
end
—————————————————————————————————————————
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
- Foldy_TPOT
-
Scratcher
100+ posts
Elif (else-if) block
What would this look like? Would it be multiple ifs part of one block?
else if <>{
}::controlwithout an if block attached, and with:if <> then{
}else if <>{
}::control- ihavenocluewhythisis
-
Scratcher
500+ posts
Elif (else-if) block
I mean, it can get very messy, but without an expander retractor thing I'm just gonna have to not support this idea.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.
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
if <> then {
} else if <> {
} else {
} (+::operators) (-::) :: controlLast 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.
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
this explains why that doesn't workif <...::#bbbbbb> then
...
else
if <...::#bbbbbb> then
...
else
...
end
end
- MillionOfficial
-
Scratcher
500+ posts
Elif (else-if) block
Support, because the workaround is BIG:
if <> thenAlso, here’s a mockup:
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
if <> then {
} else if <> then{
} (+::grey) (-::grey) :: control
