Discuss Scratch

HeHeTeeHeeHee
Scratcher
100+ posts

Is repeat until Scratch's version of the For loop?

If it isn't then what is it?

repeat until <yes>

end

HeHeTeeHeeHee wrote:

i'm brain dead aren't i
i usually use advanced topics or help with scripts but sometimes i can be found in things i'm playing and reading
RL1123
Scratcher
1000+ posts

Is repeat until Scratch's version of the For loop?

The repeat until loop is not while loop:

repeat until <not <>> // the same as a while loop

end



through tough thorough thought, though














Signature #11
lolecksdeehaha
Scratcher
1000+ posts

Is repeat until Scratch's version of the For loop?

rayli1123 wrote:

The repeat until loop is not while loop:

repeat until <not <>> // the same as a while loop

end
That… wasn't the question?
I guess, if you use it like this:
set [result v] to (0)
set [i v] to (0)
repeat until <(i) > (9)>
change [result v] by (i)
end

Beep boop. I am a robot, and this action was performed automatically. If you have any concerns, please contact the owner of this robot.

ing season coming “soon”

I'm the founder of Forumoji, the source of all those neat forum emojis you occasionally see (the ones not in the default menu).

HeHeTeeHeeHee
Scratcher
100+ posts

Is repeat until Scratch's version of the For loop?

lolecksdeehaha wrote:

rayli1123 wrote:

The repeat until loop is not while loop:

repeat until <not <>> // the same as a while loop

end
That… wasn't the question?
I guess, if you use it like this:
set [result v] to (0)
set [i v] to (0)
repeat until <(i) > (9)>
change [result v] by (i)
end


Lets be honest, who does it like that though.

HeHeTeeHeeHee wrote:

i'm brain dead aren't i
i usually use advanced topics or help with scripts but sometimes i can be found in things i'm playing and reading
lolecksdeehaha
Scratcher
1000+ posts

Is repeat until Scratch's version of the For loop?

HeHeTeeHeeHee wrote:

lolecksdeehaha wrote:

rayli1123 wrote:

~snip~
~snip~
Lets be honest, who does it like that though.
That was just an example. And a lot of people do it like that. If you don't use it like this, then it's not a for loop.

Last edited by lolecksdeehaha (Feb. 7, 2022 18:18:14)


Beep boop. I am a robot, and this action was performed automatically. If you have any concerns, please contact the owner of this robot.

ing season coming “soon”

I'm the founder of Forumoji, the source of all those neat forum emojis you occasionally see (the ones not in the default menu).

10goto10
Scratcher
500+ posts

Is repeat until Scratch's version of the For loop?

lolecksdeehaha wrote:


I guess, if you use it like this:
set [result v] to (0)
set [i v] to (0)
repeat until <(i) > (9)>
change [result v] by (i)
end
I think that’s the main difference. Nothing automatically increments the variable i as a counter So
change [i v] by (1)
needs to be in the repeat until loop.

And I’ll admit that I use it this way in my projects all the time because I don’t usually want to try and find the hidden “for each” block.

lolecksdeehaha wrote:

Lets be honest, who does it like that though.
Are you asking who, when they are designing a programming language, would not include something like:
for(var i = 0; i < 10; i++) {
}



Do you have an Animate a Name project that you'd like to have added to a studio? Please leave a comment in this studio.

lolecksdeehaha
Scratcher
1000+ posts

Is repeat until Scratch's version of the For loop?

10goto10 wrote:

lolecksdeehaha wrote:


I guess, if you use it like this:
set [result v] to (0)
set [i v] to (0)
repeat until <(i) > (9)>
change [result v] by (i)
end
I think that’s the main difference. Nothing automatically increments the variable i as a counter So
change [i v] by (1)
needs to be in the repeat until loop.

And I’ll admit that I use it this way in my projects all the time because I don’t usually want to try and find the hidden “for each” block.

HeHeTeeHeeHee wrote:

Lets be honest, who does it like that though.
Are you asking who, when they are designing a programming language, would not include something like:
for(var i = 0; i < 10; i++) {
}


You quoted OP incorrectly (I fixed it here)
Yeah, I forgot the main point of an I loop; here's the fixed one:
set [result v] to (0)
set [i v] to (0)
repeat until <(i) > (9)>
change [i v] by (1)
change [result v] by (i)
end

Beep boop. I am a robot, and this action was performed automatically. If you have any concerns, please contact the owner of this robot.

ing season coming “soon”

I'm the founder of Forumoji, the source of all those neat forum emojis you occasionally see (the ones not in the default menu).

colinmacc
Scratcher
1000+ posts

Is repeat until Scratch's version of the For loop?

The other repeat loop is more like a for loop..

repeat (10)

end

If you want to add a counter…

set [result v] to [0]
set [i v] to [0]
repeat (10)
change [i v] by (1)
change [result v] by (i)
end

Sample Projects

Powered by DjangoBB