Discuss Scratch

mybearworld
Scratcher
1000+ posts

Remove repeat until and add while

It is more usual in programming languages.

Last edited by mybearworld (March 1, 2022 13:39:41)

mybearworld
Scratcher
1000+ posts

Remove repeat until and add while

ThroughTheHourglass wrote:

Why not have both? This just creates the same problem it solved. Now if you want repeat until, you need an extra block.

mybearworld wrote:

It is more usual in programming languages.
Za-Chary
Scratcher
1000+ posts

Remove repeat until and add while

But then whenever I want to use a basic forever loop, instead of simply writing

repeat until <>

end

I'd have to put a “not” block inside this:

while <> { 

} :: control cap

That's overall more blocks. Now, the natural follow-up question is “Why wouldn't you just use a forever loop?” Well… what if I eventually decide that I need to put a boolean in my loop? Then I'd have to replace all the loops which will be more work. I'm looking for less work and less blocks here.

On another note, is it possible that “repeat until” is more intuitive than “while” for beginners?
mybearworld
Scratcher
1000+ posts

Remove repeat until and add while

Sure, but that's also how it works in other languages:
while True:
    pass
while (true) {
}
musicROCKS013
Scratcher
1000+ posts

Remove repeat until and add while

Wouldn’t the “while” block literally be an “if” block inside a repeat block?
Tunde123
Scratcher
1000+ posts

Remove repeat until and add while

musicROCKS013 wrote:

Wouldn’t the “while” block literally be an “if” block inside a repeat block?
Yes.
repeat (...)
if <> then

end
end
mybearworld
Scratcher
1000+ posts

Remove repeat until and add while

musicROCKS013 wrote:

Wouldn’t the “while” block literally be an “if” block inside a repeat block?
repeat until <not <>
IndexErrorException
Scratcher
500+ posts

Remove repeat until and add while

Clearly you don't get what a while loop even does. A while loop keeps running until a boolean has been satisfied. If you put a if in a repeat, well first off it can only run a limited amount of times(the number you put in) and the code won't stop unless you put a stop this script which is more work and slower than a built in implementation. The whole point was to reduce the amount of blocks needed to get the same functionality as a while loop.
7salad3salad
Scratcher
1000+ posts

Remove repeat until and add while

Just because it is more usual in other programming languages isn’t a really good reason for it to replace a block imo.
IndexErrorException
Scratcher
500+ posts

Remove repeat until and add while

Of course replacing the block would ruin alot of projects but we mean add a new block. It also to add familiarity to scratch if/when you switch to a real launguage.
Za-Chary
Scratcher
1000+ posts

Remove repeat until and add while

XxhackerlolxX wrote:

Of course replacing the block would ruin alot of projects but we mean add a new block.
Two things:
  • If everything's done right, I don't think this would ruin any projects. The Scratch Team seems to have successfully transferred all projects from Scratch 1.4 to Scratch 2.0, everything working as expected, despite the fact that they needed to replace all “forever if” blocks with a “forever” block containing an “if” block. I don't recall breaks/problems due to this.

  • It seems that @mybearworld is proposing that the “repeat until” block get removed and replaced with a “while” block, rather than simply adding a new “while” block to the existing editor.
EatNYeet
Scratcher
500+ posts

Remove repeat until and add while

Za-Chary wrote:

The Scratch Team seems to have successfully transferred all projects from Scratch 1.4 to Scratch 2.0, everything working as expected, despite the fact that they needed to replace all “forever if” blocks with a “forever” block containing an “if” block. I don't recall breaks/problems due to this.
It's apparent that the switch from 2.0 to 3.0 is a different story, though, and likely why this idea of replacing the “repeat until” block has raised the concern of breaking projects.

This is a genuine concern. While the “forever if” block was easily split into two, the “repeat until” block has a little bit of a different way of functioning. It's a lot less complex, for one, and working with it is less overwhelming for beginners. The block is self-explanatory, making it a little bit easier to understand. When the condition is true, the block stops repeating. However, the “while” block would repeat until the condition is false. There would certainly be some complexity in this transition. It probably would be best to leave the block as is, since the workaround is as simple as adding a “not” boolean.
mybearworld
Scratcher
1000+ posts

Remove repeat until and add while

EatNYeet wrote:

It's apparent that the switch from 2.0 to 3.0 is a different story, though,
Well, no, that's just that Scratch now runs projects differently. The blocks are still the same.
qloakonscratch
Scratcher
1000+ posts

Remove repeat until and add while

EatNYeet wrote:

Za-Chary wrote:

The Scratch Team seems to have successfully transferred all projects from Scratch 1.4 to Scratch 2.0, everything working as expected, despite the fact that they needed to replace all “forever if” blocks with a “forever” block containing an “if” block. I don't recall breaks/problems due to this.
It's apparent that the switch from 2.0 to 3.0 is a different story, though, and likely why this idea of replacing the “repeat until” block has raised the concern of breaking projects.

This is a genuine concern. While the “forever if” block was easily split into two, the “repeat until” block has a little bit of a different way of functioning. It's a lot less complex, for one, and working with it is less overwhelming for beginners. The block is self-explanatory, making it a little bit easier to understand. When the condition is true, the block stops repeating. However, the “while” block would repeat until the condition is false. There would certainly be some complexity in this transition. It probably would be best to leave the block as is, since the workaround is as simple as adding a “not” boolean.
1.4 to 2.0 removed several blocks mainly used in projects and moved them over to a new player, and added workarounds for it, making it not a different story. They are talking about replacing repeat until with while.

Anyways, adding this would make it more confusing to understand for younger ages or just all ages in general. Also, Scratch has a lot of features that are not used in other programming languages. There are also tools online to change Scratch to other programming languages to help you switch.
EatNYeet
Scratcher
500+ posts

Remove repeat until and add while

mybearworld wrote:

EatNYeet wrote:

It's apparent that the switch from 2.0 to 3.0 is a different story, though,
Well, no, that's just that Scratch now runs projects differently. The blocks are still the same.
My point is that while this is true, the fact that the update broke a lot of projects has seemed to make people believe that replacing anything can break projects.
VeryFamus
Scratcher
1000+ posts

Remove repeat until and add while

Anyways, while in itself is a good block but it isn’t good enough to replace repeat until. Repeat until starts if a Boolean isn’t active and ends once it is. While starts once a Boolean is active and ends. While the functions are similar, and mostly the same, people are used to repeat until at this point. People would end up using while for using repeat until and it would just be a confusing transition. Plus, the argument that they are too similar to be added together or that they should be swapped is a good reason to keep repeat until instead of while. Because, basically, you ar e just reversing an existing script.

Mod: Removed quote of now-deleted spam posts. Please try to avoid quoting spam, especially in the same post where you're contributing to other discussion - it makes it hard to clean up!

Last edited by Harakou (March 20, 2022 21:18:47)

LavenderLemonSquare
Scratcher
85 posts

Remove repeat until and add while

musicROCKS013 wrote:

Wouldn’t the “while” block literally be an “if” block inside a repeat block?
I think so
repeat ()
if <> then

end
end
mybearworld
Scratcher
1000+ posts

Remove repeat until and add while

LavenderLemonSquare wrote:

(#21)

musicROCKS013 wrote:

Wouldn’t the “while” block literally be an “if” block inside a repeat block?
I think so
repeat ()
if <> then

end
end
NO
It would just be
repeat until <not<
-iviedwall-
Scratcher
500+ posts

Remove repeat until and add while

Za-Chary wrote:

But then whenever I want to use a basic forever loop, instead of simply writing

repeat until <>

end

I'd have to put a “not” block inside this:

while <> { 

} :: control cap

That's overall more blocks. Now, the natural follow-up question is “Why wouldn't you just use a forever loop?” Well… what if I eventually decide that I need to put a boolean in my loop? Then I'd have to replace all the loops which will be more work. I'm looking for less work and less blocks here.

On another note, is it possible that “repeat until” is more intuitive than “while” for beginners?
So you're not gonna implement this just because you need another block? C'mon, that sounds lazy. If that's ST's logic, why don't you actually make infinity blocks used for smooth gliding, jumping, animating, and different functions that can just be done with a few blocks?
mybearworld
Scratcher
1000+ posts

Remove repeat until and add while

That is just zachary's opinion…

Powered by DjangoBB