Discuss Scratch

Codingfairy07
Scratcher
500+ posts

Elif (else-if) block

No support, super easy workaround [offtopic](“elif” is the name for a letter in Arabic)[/offtopic]

Last edited by Codingfairy07 (Aug. 5, 2021 15:24:59)

Maximouse
Scratcher
1000+ posts

Elif (else-if) block

Codingfairy07 wrote:

No support, super easy workaround [offtopic](“elif” is the name for a letter in Arabic)[/offtopic]
The purpose of this suggestion is to make code cleaner, not to make anything easier.
AlfabetonsOfficial
Scratcher
100+ posts

Elif (else-if) block

Support, putting many if-else blocks could be chunky and I don't know where is where anymore.
ScolderCreations
Scratcher
1000+ posts

Elif (else-if) block

Support. Maybe we could customize how many else if's would be in the block?
SmartCat3
Scratcher
500+ posts

Elif (else-if) block

Maximouse wrote:

Codingfairy07 wrote:

No support, super easy workaround [offtopic](“elif” is the name for a letter in Arabic)[/offtopic]
The purpose of this suggestion is to make code cleaner, not to make anything easier.
In my case it would save hours
Buhron8312480
Scratcher
100+ posts

Elif (else-if) block

Support all of ypur are worng
if <> then {

}elif <> {

}:: control
[/scratchblocks
-gge
Scratcher
1000+ posts

Elif (else-if) block

Buhron8312480 wrote:

Support all of ypur are worng
what
han614698
Scratcher
1000+ posts

Elif (else-if) block

Mock-up

if <> then{

}elif <>{

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

Elif (else-if) block

support, i hate nesting if else blocks
maybe add an option to set how much else ifs or if then else if then else?
if <> then {

} else if <> then {

} else {

} :: control
SuperMarioHome
Scratcher
100+ posts

Elif (else-if) block

Support.

if <> then {

} else {

} ▼ :: control

My idea would be to give the ‘if <> then, else’ block input arrows (but vertical). Clicking the down arrow would make these:`

if <> then {

} else, if <> then {

} else {

} ▼▲ :: control

if <> then {

} else, if <> then {

} else, if <> then {

} else {

} ▼▲ :: control
and so on.

Clicking the up arrow would reverse this.

Please bump this as it seems like a good idea.

Last edited by SuperMarioHome (Aug. 20, 2021 07:09:09)

Reev0102
Scratcher
1000+ posts

Elif (else-if) block

Support. This would make code a lot shorter. However, “elif” should be renamed to “else if”, because “elif” might confuse New Scratchers.

This feature exists in JavaScript, Python and a lot of other programming languages..

if <> then {

} else if <> {

} else if <> {

} else {

} ▼▲ :: control

Last edited by Reev0102 (Sept. 8, 2021 03:07:45)

Vaibhs11
Scratcher
1000+ posts

Elif (else-if) block

Reev0102 wrote:

Support. This would make code a lot shorter. However, “elif” should be renamed to “else if”, because “elif” might confuse New Scratchers.

This feature exists in JavaScript and Python.
Because it exists in C.
Reev0102
Scratcher
1000+ posts

Elif (else-if) block

Vaibhs11 wrote:

Reev0102 wrote:

Support. This would make code a lot shorter. However, “elif” should be renamed to “else if”, because “elif” might confuse New Scratchers.

This feature exists in JavaScript and Python.
Because it exists in C.
Why are you C'ing me so much?
Unithlees3
Scratcher
1000+ posts

Elif (else-if) block

Reev0102 wrote:

Vaibhs11 wrote:

Reev0102 wrote:

Support. This would make code a lot shorter. However, “elif” should be renamed to “else if”, because “elif” might confuse New Scratchers.

This feature exists in JavaScript and Python.
Because it exists in C.
Why are you C'ing me so much?
because c /hj
han614698
Scratcher
1000+ posts

Elif (else-if) block

How about?

if <> then{


}else{

}end @delInput @addInput::control

Last edited by han614698 (Oct. 29, 2021 21:28:06)

han614698
Scratcher
1000+ posts

Elif (else-if) block

meant to hit “go back”

Last edited by han614698 (Oct. 29, 2021 21:31:50)

medians
Scratcher
1000+ posts

Elif (else-if) block

Unithlees3 wrote:

Reev0102 wrote:

Vaibhs11 wrote:

Reev0102 wrote:

Support. This would make code a lot shorter. However, “elif” should be renamed to “else if”, because “elif” might confuse New Scratchers.

This feature exists in JavaScript and Python.
Because it exists in C.
Why are you C'ing me so much?
because c /why
I. Am. Done.

han614698 wrote:

How about?

if <> then{


}else{

}end @delInput @addInput::control
yesss
if <> then{


}else if <> {

} else {
} end @delInput @addInput::control
Inkay1954
Scratcher
75 posts

Elif (else-if) block

I have long abandoned this suggestion since I left Scratch.

I'm back now, and I'm proud to say that we definitely need this. If you put too many if-else blocks inside of each other, it's hard to find out where is where.

Also, yes, we should rename it to else if because this is hard to understand for some and also because elif is said to be an Arabic word or something…

Thank you for supporting when I wasn't there.
dave-alt-4
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.

What's wrong with simply stacking if/elses?
-snip-
this :
if <touching color [#000000] ?> then 
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else
if <touching color [#000000] ?> then
change x by (1)
else

end
end
end
end


end
end
end
end


end
end
end
end


end
end
end
end


end
end
end
end




end
end
end
end


end
end
end
end


end
end
end
end


end
end
end
end


end
end
end
end
banana439monkey
Scratcher
1000+ posts

Elif (else-if) block

elif improves code efficiency, highly useful and cuts down on the insane amount of code. imo, it should work like this
if <condition :: sensing> then {
action :: custom
} {
else if <condition :: sensing> {
action :: custom
} :: control
else if <condition :: sensing> {
and repeat etc for however many conditions :: custom
} :: control
} else {
action :: custom
} :: control
Maybe UX could design something that would signify that the second C is for elif statements only? This is all hypothetical and it's not nearly perfect but it decently portrays the idea.

Banana

Powered by DjangoBB