Discuss Scratch
- Discussion Forums
- » Suggestions
- » Make the 'for each' loop available in the block palette
- UnsungCress
-
Scratcher
28 posts
Make the 'for each' loop available in the block palette
It's already in the editor (if you hack it in) and it's perfectly functional, so why not just add it into the palette without having to go through the extra effort of hacking in the block or backpacking it from someone else?
It would be more convenient and would save a lot of trouble.
It would be more convenient and would save a lot of trouble.
- -Sound_Effect-
-
Scratcher
66 posts
Make the 'for each' loop available in the block palette
It's the same as a Repeat block. It's easier for people of a younger age to understand.
Check out: https://en.scratch-wiki.info/wiki/For_Each_()_in_()_(block) - It's the wiki page for the For Each Loop.
repeat ()
end
Check out: https://en.scratch-wiki.info/wiki/For_Each_()_in_()_(block) - It's the wiki page for the For Each Loop.
- MagicCoder330
-
Scratcher
1000+ posts
Make the 'for each' loop available in the block palette
It's the same as a Repeat block. It's easier for people of a younger age to understand.repeat ()
end
Check out: https://en.scratch-wiki.info/wiki/For_Each_()_in_()_(block) - It's the wiki page for the For Each Loop.
Its sort of like a repeat block, but it is a bit different. A repeat block just repeats a certain amount of times, while the for each () in () block repeats it for every () in (). For instance, if the first number is 5 and the second is 15, it will repeat 3 times. I agree that it isn't the most useful thing in existence, but it has some use.
- UnsungCress
-
Scratcher
28 posts
Make the 'for each' loop available in the block palette
Well yes, but using the for loop would be more convenient for those who do know how it works.
- KingRat_1
-
Scratcher
100+ posts
Make the 'for each' loop available in the block palette
wouldIt's the same as a Repeat block. It's easier for people of a younger age to understand.repeat ()
end
Check out: https://en.scratch-wiki.info/wiki/For_Each_()_in_()_(block) - It's the wiki page for the For Each Loop.
Its sort of like a repeat block, but it is a bit different. A repeat block just repeats a certain amount of times, while the for each () in () block repeats it for every () in (). For instance, if the first number is 5 and the second is 15, it will repeat 3 times. I agree that it isn't the most useful thing in existence, but it has some use.
((15) / (5))not do the same thing?
Last edited by KingRat_1 (Dec. 5, 2023 18:47:00)
- UnsungCress
-
Scratcher
28 posts
Make the 'for each' loop available in the block palette
It's the same as a Repeat block. It's easier for people of a younger age to understand.repeat ()
end
Check out: https://en.scratch-wiki.info/wiki/For_Each_()_in_()_(block) - It's the wiki page for the For Each Loop.
Its sort of like a repeat block, but it is a bit different. A repeat block just repeats a certain amount of times, while the for each () in () block repeats it for every () in (). For instance, if the first number is 5 and the second is 15, it will repeat 3 times. I agree that it isn't the most useful thing in existence, but it has some use.
In my experience, it works like
set [amount v] to [0]
repeat ( amount )
change [amount v] by (1)
end
but in a single loop. For example, if you did this
for each [amount v] in (5){
move (amount) steps
} :: controlthen the sprite would move 1 step, then 2, 3 4 and 5.MagicCoder300, you're thinking of
repeat ( () / () )
end
- yadayadayadagoodbye
-
Scratcher
1000+ posts
Make the 'for each' loop available in the block palette
In my experience, it works likeActually, you would doset [amount v] to [0]
repeat ( amount )
change [amount v] by (1)
end
set [i v] to [1]to imitate a for loop (obviously, make the change i value increase to have it go faster and stuff)
repeat until <[5] < (i)>
change [i v] by (1)
end
- UnsungCress
-
Scratcher
28 posts
Make the 'for each' loop available in the block palette
Actually, you would doThey both do pretty much the same thing.set [i v] to [1]to imitate a for loop (obviously, make the change i value increase to have it go faster and stuff)
repeat until <[5] < (i)>
change [i v] by (1)
end
- EDawg2011
-
Scratcher
1000+ posts
Make the 'for each' loop available in the block palette
Children probably won't understand this block, so it might get renamed to something like “(variable name) count to (input)” 
(Someone please tell me how to make a custom C block. (Edit: in a forum post.))
Another edit: I found it out.

(Someone please tell me how to make a custom C block. (Edit: in a forum post.))
Another edit: I found it out.
[x v] count to (){
} :: control3rd edit: Fixed block.Last edited by EDawg2011 (Dec. 5, 2023 22:09:18)
- IndexErrorException
-
Scratcher
500+ posts
Make the 'for each' loop available in the block palette
Support, don't rename. I already use this block in most of my programs, it takes a couple steps out.
- unmissable
-
Scratcher
1000+ posts
Make the 'for each' loop available in the block palette
Support because it can actually be useful
And it's not like they're going to need to code it since it already exists
edit:typo
And it's not like they're going to need to code it since it already exists
edit:typo
Last edited by unmissable (Dec. 5, 2023 23:31:52)
- EDawg2011
-
Scratcher
1000+ posts
Make the 'for each' loop available in the block palette
Support, don't rename. I already use this block in most of my programs, it takes a couple steps out.It would need to be renamed because its name is very vague. wdym by “for each (foo v) in (n)” Does it divide “n” by “foo” and repeat it that many times, or does it do something for each time the “n” is contained in “foo”? It's confusing, and I didn't even know how it worked.

- Scratchedbyyou
-
Scratcher
100+ posts
Make the 'for each' loop available in the block palette
Support, I use the workaround a lot and it's getting annoying, I also don't want to get my project marked as nfe for using the removed block in a project either.
- ajskateboarder
-
Scratcher
1000+ posts
Make the 'for each' loop available in the block palette
This is how almost every language has named for loopsSupport, don't rename. I already use this block in most of my programs, it takes a couple steps out.It would need to be renamed because its name is very vague. wdym by “for each (foo v) in (n)” Does it divide “n” by “foo” and repeat it that many times, or does it do something for each time the “n” is contained in “foo”? It's confusing, and I didn't even know how it worked.

Also, this is a very related suggestion: https://scratch.mit.edu/discuss/topic/204415/
- No_Normal
-
Scratcher
100+ posts
Make the 'for each' loop available in the block palette
It's the same as a Repeat block. It's easier for people of a younger age to understand.No, the repeat block has its own use, I wish there was a for each in i, because it is really helpful and some of my projects are slow because the workaround adds a bunch of blocks.repeat ()
end
Check out: https://en.scratch-wiki.info/wiki/For_Each_()_in_()_(block) - It's the wiki page for the For Each Loop.
- RediblesQW_Doors
-
Scratcher
38 posts
Make the 'for each' loop available in the block palette
for each [var v] in (…){
}::controlLast edited by RediblesQW_Doors (Dec. 17, 2023 13:27:59)
- ichan2
-
Scratcher
2 posts
Make the 'for each' loop available in the block palette
Sorry i posted something but it was wrong

Last edited by ichan2 (April 11, 2024 10:47:57)
- banana439monkey
-
Scratcher
1000+ posts
Make the 'for each' loop available in the block palette
and maybe even a
Banana
range between () and () :: list reporterblock?
Banana
- Discussion Forums
- » Suggestions
-
» Make the 'for each' loop available in the block palette














