Discuss Scratch
- Discussion Forums
- » Suggestions
- » Break out of Loop block
- quadruple_door
-
Scratcher
100+ posts
Break out of Loop block
Stop(this loop v) ::controlthis would be a scratch block that when used, does what it says, breaks out of a loop!
(example)
|
|
|
V
when green flag clicked
set [my variable v] to [0]
set [ random variable v] to (pick random (1) to (900))
repeat (900)
change [my variable v] by (1)
if < (my variable) = (random variable) > then
Stop(this loop v) ::control
end
end
do whatever now
(for context, if a loop is inside a loop it wont stop both loops, only the one its in.)
(this wont do anything outside a loop)
- __Falcon-Games__
-
Scratcher
1000+ posts
Break out of Loop block
Support. This would be just plain useful and would be probably easy to implement. This shouldn't be the top priority of the ST of course.
- Scratchcat12562
-
Scratcher
100+ posts
Break out of Loop block
stop [this script v]This block exists already
- 7salad3salad
-
Scratcher
1000+ posts
Break out of Loop block
The issue with that is that it doesnt carry on with blocks after the loop, and just cancels the entire script.stop [this script v]This block exists already
Also, couldnt you use broadcasts for this?
Last edited by 7salad3salad (Aug. 30, 2023 11:41:13)
- Zydrolic
-
Scratcher
1000+ posts
Break out of Loop block
(#3)OP wants to stop the loop and continue the code, not the entire paragraph of code.stop [this script v]This block exists already
Just clarifying.
EDIT: Darn it, I got ninja'd — Well played. i am going to eat your palacsinta (/j)
Last edited by Zydrolic (Aug. 30, 2023 11:42:10)
- __Falcon-Games__
-
Scratcher
1000+ posts
Break out of Loop block
why aren't kids smarter?stop [this script v]This block exists already
They mean break out of the current loop, not break out of the current script/stop the script.
Last edited by __Falcon-Games__ (Aug. 30, 2023 16:43:36)
- Scratchcat12562
-
Scratcher
100+ posts
Break out of Loop block
oh i understand now this would be pretty useful for stuffwhy aren't kids more smarter?stop [this script v]This block exists already
They mean break out of the current loop, not break out of the current script/stop the script.
- CrazyCoder1247
-
Scratcher
100+ posts
Break out of Loop block
first of all, __Falcon-Games__, be nice, second of all, look:oh i understand now this would be pretty useful for stuffwhy aren't kids more smarter?stop [this script v]This block exists already
They mean break out of the current loop, not break out of the current script/stop the script.
repeat until <>amazing, right?
end
Last edited by CrazyCoder1247 (Aug. 30, 2023 12:09:42)
- __Falcon-Games__
-
Scratcher
1000+ posts
Break out of Loop block
1. I am being nice, I was just wondering a question which I put in small tags which didn't have to be noticed by anyone which wasn't meant to cause any offensefirst of all, __Falcon-Games__, be nice, second of all, look:oh i understand now this would be pretty useful for stuffwhy aren't kids more smarter?stop [this script v]This block exists already
They mean break out of the current loop, not break out of the current script/stop the script.repeat until <>amazing, right?
end
2. What does that have to do with this suggestion?
- quadruple_door
-
Scratcher
100+ posts
Break out of Loop block
i see, also funny how you say be nice, then immediately switch to sarcasm.first of all, __Falcon-Games__, be nice, second of all, look:oh i understand now this would be pretty useful for stuffwhy aren't kids more smarter?stop [this script v]This block exists already
They mean break out of the current loop, not break out of the current script/stop the script.repeat until <>amazing, right?
end
- Zydrolic
-
Scratcher
1000+ posts
Break out of Loop block
(#11)oh come on, we all love us some sarcasm
i see, also funny how you say be nice, then immediately switch to sarcasm.
especially since repeat until is from control so we actually wouldn't really need a dropdown, since we already are getting our if statement

(dont mind the fact its in hungarian)
EDIT: rough around the edge, even if Scratch is meant to be simple.
Anyone able to provide an example where repeat until <> canNOT be used for a line of code?
Last edited by Zydrolic (Aug. 30, 2023 12:27:02)
- __Falcon-Games__
-
Scratcher
1000+ posts
Break out of Loop block
Anyone able to provide an example where repeat until <> canNOT be used for a line of code?
do init stuff here :: control
forever
if < cond :: operators > then
do stuff here :: control
stop [this loop v]
else
do other stuff here :: control
end
end
do final stuff here :: control
If someone can find replacement code for this using repeat until <> then I will stop supporting this suggestion.
- Zydrolic
-
Scratcher
1000+ posts
Break out of Loop block
(#13)forever
if < cond :: operators > then
do stuff here :: control
stop [this loop v]
else
do other stuff here :: control
end
end
do final stuff here :: control
... // whateveror do it the opposite way, whatever is needed
repeat until <condition if needed :: operators>
if <condition :: operators> then
... // "other" code
else
... // do whatever
anything?
- __Falcon-Games__
-
Scratcher
1000+ posts
Break out of Loop block
OBJECTION! that was a reference It needs to break out of the loop there but it doesn't in the other code, it will check if it's that condition then do that code and keep repeating it until the specified condition, it needs to break out of it and go onto the final stuff in the other code.(#13)forever
if < cond :: operators > then
do stuff here :: control
stop [this loop v]
else
do other stuff here :: control
end
end
do final stuff here :: control... // whateveror do it the opposite way, whatever is needed
repeat until <condition if needed :: operators>
if <condition :: operators> then
... // "other" code
else
... // do whatever
anything?
- Zydrolic
-
Scratcher
1000+ posts
Break out of Loop block
OBJECTION! that was a reference It needs to break out of the loop there but it doesn't in the other code, it will check if it's that condition then do that code and keep repeating it until the specified condition, it needs to break out of it and go onto the final stuff in the other code.HOLD IT! i get it You can just put another condition afterwards to check what part of the code it requires or needs to run again before proceeding onto the final line of code.
In short:

Last edited by Zydrolic (Aug. 30, 2023 12:50:19)
- __Falcon-Games__
-
Scratcher
1000+ posts
Break out of Loop block
TAKE THAT! If the condition is something that will be different when it reaches the final part of the code then it needs to break the loop there so the condition is the same.OBJECTION! that was a reference It needs to break out of the loop there but it doesn't in the other code, it will check if it's that condition then do that code and keep repeating it until the specified condition, it needs to break out of it and go onto the final stuff in the other code.HOLD IT! i get it You can just put another condition afterwards to check what part of the code it requires or needs to run again before proceeding onto the final line of code.
In short:
this is not a good argument but I am trying to get this suggestion accepted now, whatever it may take
- Zydrolic
-
Scratcher
1000+ posts
Break out of Loop block
(#17)heh, did'ja really think you could-
TAKE THAT! If the condition is something that will be different when it reaches the final part of the code then it needs to break the loop there so the condition is the same.
this is not a good argument but I am trying to get this suggestion accepted now, whatever it may take
…
welp.
ya got me.
- cookieclickerer33
-
Scratcher
1000+ posts
Break out of Loop block
*cough*
And also I guess
repeat (you can’t change the number after it starts)You could technically use variables but you would need to make a new one for each loop
end
And also I guess
For each [i v] to (10){
}::controlBut it doesn’t exist in the normal pallet anymoreLast edited by cookieclickerer33 (Aug. 31, 2023 11:46:58)
- Discussion Forums
- » Suggestions
-
» Break out of Loop block






