Discuss Scratch
- Discussion Forums
- » Suggestions
- » Why no for loops?
- DaEpikDude
- Scratcher
1000+ posts
Why no for loops?
Most people who've used other programming languages probably know about for loops.
How come Scratch doesn't have them yet?
I understand you can work it around with a variable, but that applies to all languages.
Why not make it the first list C block?
Before you go and say “but there's a workaround”, that doesn't stop other languages from having them, despite being able to use while loops.
I know Scratch isn't “other languages”, but this makes it really easy to interact with everything in a list.
How come Scratch doesn't have them yet?
I understand you can work it around with a variable, but that applies to all languages.
Why not make it the first list C block?
for each (item) in [list v] {The “item” would be duplicated when you interact with it (think custom block arguments).
...
}::list //Not sure about the colour of the "item" reporter
Before you go and say “but there's a workaround”, that doesn't stop other languages from having them, despite being able to use while loops.
I know Scratch isn't “other languages”, but this makes it really easy to interact with everything in a list.
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- FancyFoxy
- Scratcher
500+ posts
Why no for loops?
I support this. This is one of those blocks that you will see again in other languages. Why not here?
THIS IS MY SIGNATURE. THIS MEANS IT IS AN AUTOMATIC MESSAGE THAT APPEARS AT THE BOTTOM OF ALL MY POSTS.
Hi! I'm FancyFoxy! I create animations and games that were never, EVER meant to be taken seriously.
FancyFoxy Heroes and #Thanksgiving are some of my latest projects, check them out!
- Wahsp
- Scratcher
1000+ posts
Why no for loops?
Because America! I support this. This is one of those blocks that you will see again in other languages. Why not here?
No? Sorry
Anyway I give full support as well.
(also it's not important but when I was making the text grey I spelled it with an a because also america) I'll leave
I am Wahsp
______________________________________________________
Formerly pretty active on the forums, probably mostly retired now…
If you see one of my posts send me a hello!
______________________________________________________
- PkmnQ
- Scratcher
1000+ posts
Why no for loops?
While it is consistent, the name isn't good. Most people who've used other programming languages probably know about for loops.
How come Scratch doesn't have them yet?
I understand you can work it around with a variable, but that applies to all languages.
Why not make it the first list C block?for each (item) in [list v] {The “item” would be duplicated when you interact with it (think custom block arguments).
...
}::list //Not sure about the colour of the "item" reporter
Before you go and say “but there's a workaround”, that doesn't stop other languages from having them, despite being able to use while loops.
I know Scratch isn't “other languages”, but this makes it really easy to interact with everything in a list.
This is an account that exists.
Here, have a useful link:
The Official List of Rejected Suggestions by Za-Chary
- DaEpikDude
- Scratcher
1000+ posts
Why no for loops?
What would you suggest?While it is consistent, the name isn't good. Most people who've used other programming languages probably know about for loops.
How come Scratch doesn't have them yet?
I understand you can work it around with a variable, but that applies to all languages.
Why not make it the first list C block?for each (item) in [list v] {The “item” would be duplicated when you interact with it (think custom block arguments).
...
}::list //Not sure about the colour of the "item" reporter
Before you go and say “but there's a workaround”, that doesn't stop other languages from having them, despite being able to use while loops.
I know Scratch isn't “other languages”, but this makes it really easy to interact with everything in a list.
“For” seems to make its function clear: it does something for every item in the list.
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- braxbroscratcher
- Scratcher
1000+ posts
Why no for loops?
set [counter v] to [0]
repeat (length of [list v] :: list)
change [counter v] by (1)
. . . :: grey // loop contents
end
(item (counter) of [list v] :: list) // use this for inputs
I don't see why we need it, the workaround's pretty easy. Once we get custom loops this would be even easier.
My signature is kumquat proof.
But not tangerine pro-
nomnomnomnomnom
- Charles12310
- Scratcher
1000+ posts
Why no for loops?
I don't think that's what they're talking about.set [counter v] to [0]
repeat (length of [list v] :: list)
change [counter v] by (1)
. . . :: grey // loop contents
end
(item (counter) of [list v] :: list) // use this for inputs
I don't see why we need it, the workaround's pretty easy. Once we get custom loops this would be even easier.
set [a v] to [0]
set [b v] to [0]
set [content v] to [...]
repeat (length of [list v])
change [a v] by (1)
if <(item (a) of [list v]) = (content)> then
change [b v] by (1)
end
end
repeat (b)
...
end
A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
- braxbroscratcher
- Scratcher
1000+ posts
Why no for loops?
he's talking about a for loop and a reporter that yields an item of a list based upon the iteration. It's really easy.I don't think that's what they're talking about.set [counter v] to [0]
repeat (length of [list v] :: list)
change [counter v] by (1)
. . . :: grey // loop contents
end
(item (counter) of [list v] :: list) // use this for inputs
I don't see why we need it, the workaround's pretty easy. Once we get custom loops this would be even easier.set [a v] to [0]
set [b v] to [0]
set [content v] to [...]
repeat (length of [list v])
change [a v] by (1)
if <(item (a) of [list v]) = (content)> then
change [b v] by (1)
end
end
repeat (b)
...
end
My signature is kumquat proof.
But not tangerine pro-
nomnomnomnomnom
- DaEpikDude
- Scratcher
1000+ posts
Why no for loops?
Yes, I know there is an easy workaround, but my reasoning is that for loops exist in some form in basically every language. Why don't they exist in Scratch?set [counter v] to [0]
repeat (length of [list v] :: list)
change [counter v] by (1)
. . . :: grey // loop contents
end
(item (counter) of [list v] :: list) // use this for inputs
I don't see why we need it, the workaround's pretty easy. Once we get custom loops this would be even easier.
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- braxbroscratcher
- Scratcher
1000+ posts
Why no for loops?
For loops are technically ourYes, I know there is an easy workaround, but my reasoning is that for loops exist in some form in basically every language. Why don't they exist in Scratch?set [counter v] to [0]
repeat (length of [list v] :: list)
change [counter v] by (1)
. . . :: grey // loop contents
end
(item (counter) of [list v] :: list) // use this for inputs
I don't see why we need it, the workaround's pretty easy. Once we get custom loops this would be even easier.
repeat ()loops as all a for loop does is repeat for X number of times. It's the i (iteration) counter that allows you to act on specific items of lists. Sure, this may be hidden in some languages inside the function, but I don't think the workaround is too hard to do, especially since it lets you understand how for loops work.
end
My signature is kumquat proof.
But not tangerine pro-
nomnomnomnomnom
- Ferociousfeind
- Scratcher
100+ posts
Why no for loops?
Full support, though the name “for (item) in (list)” is somewhat unclear and not in Scratch's “it reads like an actually grammatically correct sentence!” like "if <> then“, ”touching ( v)?“, ”ask () and wait“, these all tell you exactly what they do, while ”for (item) in (list)" just doesn't. Perhaps something like
would work better
repeat every (item) in [list v] {
. . . :: tips
} :: list
would work better
Beep boop workin' on makin' silly games and nonsense.
Help wanted developing The Legend of Knight (working title) https://scratch.mit.edu/projects/171496233/
- -Rex-
- Scratcher
500+ posts
Why no for loops?
What about
repeat through [list v] with (var :: control) as each item {
...
} :: control
Last edited by -Rex- (Sept. 7, 2017 01:40:13)
- Charles12310
- Scratcher
1000+ posts
Why no for loops?
then“, ”touching ( v)?“, ”ask () and wait“, these all tell you exactly what they do, while ”for (item) in (list)" just doesn't. Perhaps something likeOther languages use “for every () in ()”. Full support, though the name “for (item) in (list)” is somewhat unclear and not in Scratch's “it reads like an actually grammatically correct sentence!” like "if <>repeat every (item) in [list v] {
. . . :: tips
} :: list
would work better
A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
- -Rex-
- Scratcher
500+ posts
Why no for loops?
Scratch is meant to be easier to understand than other languages. While a for loop would be nice, the name of the block would have to be changed to something more easily understandable.Other languages use “for every () in ()”. …
- DaEpikDude
- Scratcher
1000+ posts
Why no for loops?
I like that wording, yeah. That's good! What aboutrepeat through [list v] with (var :: control) as each item {
...
} :: control
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- kenny2scratch
- Scratcher
500+ posts
Why no for loops?
Meh, I know the feeling…
and yet then there's
and yet then there's
set [i v] to [0]
repeat (length of [list v])
change [i v] by (1)
set [var v] to (item (i) of [list v])
...
end
post brought to you by the preview links bug and previously the uploads site bug. 看一下中文 Scratch 維基!想參加?請參考這頁。
- TimeLordPlanet
- Scratcher
500+ posts
Why no for loops?
Support here! When I was in Python, I was super confused as to what a for loop was due to lack of corresponding Scratch Blocks,
I like Scratch 3.0! An immesurable improvment! Banner coming soon!
- Za-Chary
- Scratcher
1000+ posts
Why no for loops?
It looks like this is a duplicate topic of this one over here, so I’ll close this thread to keep the conversation all in one place.
Feel free to continue the discussion in the link provided above.
Feel free to continue the discussion in the link provided above.
This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.
I was a Scratch Team member from May 10th 2019 to October 29th 2021.
my notebook | scratch team essay | accessibility essay
- Discussion Forums
- » Suggestions
- » Why no for loops?