Discuss Scratch
- Discussion Forums
- » Suggestions
- » Suggestion 57: repeat reporter
- Tubeonscratch
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
not this:
repeat (10)this
end
(repeat (10) of () :: control)It's basically the same thing. You can use it for things like this:
(repeat (10) of (join [ma][no]) :: control)you might be thinking:
no support. You can make the example with the join blockyeah, you can. but that's LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG
Last edited by Tubeonscratch (May 13, 2026 19:13:59)
- medians
-
Scratcher
1000+ posts
Suggestion 57: repeat reporter
no support. You can make the example with the join block
Anyway, here's a workaround for anyone that wants it for now:
Anyway, here's a workaround for anyone that wants it for now:
define repeat (string) (n) timesHowever, Scratch should have custom reporters and local variables, so:
set [res v] to []
repeat (n)
set [res v] to (join (res) (string))
end
define (repeat (string::custom-arg) (n::custom-arg) times::custom)
set [res] to []::#1b37da
repeat (n::custom-arg)
set [res] to (join (get [res]::#1b37da) (string::custom-arg))::#1b37da
end
return (get [res]::#1b37da)::custom cap
Last edited by medians (May 13, 2026 19:17:05)
- bubgamer07
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
no support. You can make the example with the join block
- Tubeonscratch
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
no support. You can make the example with the join blockis this ragebait
- I_wantasheep
-
Scratcher
1000+ posts
Suggestion 57: repeat reporter
i don't see any uses for this
collapse until further notice
collapse until further notice
- medians
-
Scratcher
1000+ posts
Suggestion 57: repeat reporter
no support. You can make the example with the join blockno support. You can make the example with the join blockis this ragebait
Anyway, I might make a backpackable ver of the above script if I haven't LOL
- Michael_M_Games
-
Scratcher
500+ posts
Suggestion 57: repeat reporter
Support, I can see this being useful. The join block workaround is LONG 

- Tubeonscratch
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
Wait guys this is useful
4444444444
It will kinda be like: 1949357026
(repeat (10) of (pick random (1) to (9))::control)It won't repeat the same number like:
4444444444
It will kinda be like: 1949357026
Last edited by Tubeonscratch (Aug. 12, 2026 15:31:32)
- _nix
-
Scratcher
1000+ posts
Suggestion 57: repeat reporter
There really aren't a lot of non-deterministic reporters in base Scratch (“pick random” is maybe the only everyday one), but with custom reporters there could be lots (since you can code your own reporters to have side effects).
If “my list” contains items “a b c d e”, the repeat reporter would return “abc” and the list would be left with just “d e”.
edit: I KNOW this operation is supposed to be called “shift” not “pop”, sorry lol
(repeat (3) (pop first item of [my list v] :: custom) :: control)
define (pop first item of (list :: custom-arg)) :: hat // sorry for this annoying scratchblocks :P
set [item v] to (item (1) of (list ::custom-arg)
delete (1) of (list ::custom-arg)
return (item) :: custom cap
If “my list” contains items “a b c d e”, the repeat reporter would return “abc” and the list would be left with just “d e”.
edit: I KNOW this operation is supposed to be called “shift” not “pop”, sorry lol
Last edited by _nix (Aug. 12, 2026 16:30:31)
- PickleMan_5000
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
you might be thinking:no support. You can make the example with the join blockyeah, you can. but that's LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG
here's a workaround that uses the
repeat (...)
end
block:
repeat (...)
add [...] to [list v]
end
then use (list :: list) as the output, it might have spaces in it so either [hellohellohello] or [hello hello hello]::sensing hat
Wait guys this is usefulyeah this is good, the workaround you can set the repeat as any number or variable(repeat (10) of (pick random (1) to (9))::control)It won't repeat the same number like:
4444444444
It will kinda be like: 1949357026
Last edited by PickleMan_5000 (Aug. 12, 2026 16:56:35)
- redspacecat
-
Scratcher
1000+ posts
Suggestion 57: repeat reporter
Seems useful, but it seems more useful to have custom blocks that can return values and call-specific temporary variables within custom blocks, as medians said above.
That would allow recreating this repeat reporter and open up infinite possibilities. Too bad it will probably never happen. :(
That would allow recreating this repeat reporter and open up infinite possibilities. Too bad it will probably never happen. :(
Last edited by redspacecat (Aug. 12, 2026 16:54:50)
- Tubeonscratch
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
Seems useful, but it seems more useful to have custom blocks that can return values and call-specific temporary variables within custom blocks, as medians said above.So, like
That would allow recreating this repeat reporter and open up infinite possibilities. Too bad it will probably never happen. :(
return (1) :: custom cap
- gelatin-free
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
no support. You can make the example with the join block
- Tubeonscratch
-
Scratcher
100+ posts
Suggestion 57: repeat reporter
no support. You can make the example with the join blockOk bro
- r3hehehehehhe
-
Scratcher
1000+ posts
Suggestion 57: repeat reporter
Support
There's a really long workaround
There's a really long workaround
- DeathReviews
-
Scratcher
500+ posts
Suggestion 57: repeat reporter
no support. You can make the example with the join block
- _nix
-
Scratcher
1000+ posts
Suggestion 57: repeat reporter
Seems useful, but it seems more useful to have custom blocks that can return values and call-specific temporary variables within custom blocks, as medians said above.Well, you could sort of recreate the “repeat” reporter, but a naive approach doesn't quite work:
That would allow recreating this repeat reporter and open up infinite possibilities. Too bad it will probably never happen. :(
define (repeat (times ::custom-arg) (expression ::custom-arg) ::custom) ::hat
set [repeat result v] to []
repeat (times ::custom-arg)
set [repeat result v] to (join (repeat result) (expression ::custom-arg))
end
return (repeat result) ::custom cap
That would definitely work if expression is a simple string, or some other constant value. But what if it's a value that should be different each time, like “pick random 1 to 10”? Or that “pop first item of list” block I showed earlier?
say (repeat (6) (pick random (1) to (10)) ::custom)
^ This shows a string like 111111 or 555555 or 101010101010. (“pick random 1 to 9” would make more sense, but you can see the issue, right?
) We're expecting something more like 372615 or 928174 or 2541028.delete all of [my list v]
add letters of [abcdef] to [my list v] :: custom // pretend we coded this custom block too, right
say (repeat (3) (pop first item of [my list v] ::custom) ::custom)
^ This shows aaa, and the result list includes b, c, d, e, f. We're expecting abc, with only d, e, f remaining in the list.
So, really, we need an option or possibility for custom block input which are re-evaluated every time they are used in the code for the custom block. In Snap! the way you do this is kind of fancy, involving first-class procedures and all that. But Scratch should be simpler, with just a checkbox in the custom block that says “re-evaluate reporter blocks each time they're used”. With that checkbox checked, the workaround above works, and no built-in “repeat” reporter is necessary.
Remember that we need some way to re-evaluate custom block inputs in order to do custom C-blocks. You simply can't code a “while” block (or “do…while”, “do…until”) if the boolean you give the block is only evaluated once, and never again, after each loop iteration. With support for both custom reporters as well as custom C-blocks, a workaround for “repeat” is possible. But with just custom reporters, the workaround just isn't capable of much.
- Discussion Forums
- » Suggestions
-
» Suggestion 57: repeat reporter