Discuss Scratch
- Discussion Forums
- » Suggestions
- » While Loop and For Loop
- KermitMC
-
100+ posts
While Loop and For Loop
The For Loop will replace repeat.
The While Loop will replace repeat until
So instead of the block saying “repeat” it will say “For” and instead of the block saying “repeat until” it will say “While”
The blocks will work the same but just have different names.
While some of you may disprove and say this is stupid, Just keep it the same.
In proper code language for loops repeat something a certain amount of times and
while loops repeat when the statement is through and will only stop when it is not.
The While Loop will replace repeat until
So instead of the block saying “repeat” it will say “For” and instead of the block saying “repeat until” it will say “While”
The blocks will work the same but just have different names.
While some of you may disprove and say this is stupid, Just keep it the same.
In proper code language for loops repeat something a certain amount of times and
while loops repeat when the statement is through and will only stop when it is not.
- Sonickyle
-
1000+ posts
While Loop and For Loop
Keep in mind that Scratch is created with 6+ year olds in mind.
- KermitMC
-
100+ posts
While Loop and For Loop
I was wondering why the program was made sooo easy to use. Keep in mind that Scratch is created with 6+ year olds in mind.
- Diamond_Projects
-
100+ posts
While Loop and For Loop
+1 :: control
Last edited by Diamond_Projects (Sept. 17, 2014 02:26:17)
- OmnipotentPotato
-
1000+ posts
While Loop and For Loop
While is okay, but not sure about the for loop.
One problem, the only languages I'm completely fluent with are Scratch and TI-BASIC (for TI-84 calculators). In TI-BASIC, the for loop is completely different. It's something like this:
For(variable, number#1, number#2, number#3)
Code;
Code;
Code;
Code;
End
Where variable is a variable the loop uses, number#1 is the initial value of variable, number#2 is the ending point of the variable, and number#3 is the rate at which the variable increases every loop. So, the variable starts at number#1 and changes itself by number#3 every time the loop completes until it is greater than or equal to number#2.
This is not at all what you are recommending. Is this what the for loop does in other languages, or just TI-BASIC? Because, if it's like this in other languages, I would say don't do this. Otherwise, support.
tl;dr: no support unless for loop is not what I think it is.
One problem, the only languages I'm completely fluent with are Scratch and TI-BASIC (for TI-84 calculators). In TI-BASIC, the for loop is completely different. It's something like this:
For(variable, number#1, number#2, number#3)
Code;
Code;
Code;
Code;
End
Where variable is a variable the loop uses, number#1 is the initial value of variable, number#2 is the ending point of the variable, and number#3 is the rate at which the variable increases every loop. So, the variable starts at number#1 and changes itself by number#3 every time the loop completes until it is greater than or equal to number#2.
This is not at all what you are recommending. Is this what the for loop does in other languages, or just TI-BASIC? Because, if it's like this in other languages, I would say don't do this. Otherwise, support.

tl;dr: no support unless for loop is not what I think it is.
Last edited by OmnipotentPotato (Aug. 25, 2014 02:54:28)
- 20btheilmanngohr
-
100+ posts
While Loop and For Loop
I'm fine if the for loop is:
for (10) loops:: c-block controlbut I don't like while, cause instead of saying “Repeat Until”, it's saying “While”, which sounds more like it runs the script while the boolean is running, most likely to confuse many people, so semi-support.
end
- mathfreak231
-
1000+ posts
While Loop and For Loop
Replacing “repeat until” with “while” would break many projects as the block would have an opposite meaning, repeating the script until the boolean is false rather than true.
I'd be OK if it were deprecated or something, but really, what's the point? Besides, many programming languages do have an “until” structure, although it works slightly different.
I'd be OK if it were deprecated or something, but really, what's the point? Besides, many programming languages do have an “until” structure, although it works slightly different.
- RandomPerson1789
-
100+ posts
While Loop and For Loop
while loop solution
repeat until <not <condition>>
end
- OmnipotentPotato
-
1000+ posts
While Loop and For Loop
No, the while block would be the same as repeat until. Exactly the same except for the names. while loop solutionrepeat until <not <condition>>
end
- djdolphin
-
1000+ posts
While Loop and For Loop
until != whileNo, the while block would be the same as repeat until. Exactly the same except for the names. while loop solutionrepeat until <not <condition>>
end
- OmnipotentPotato
-
1000+ posts
While Loop and For Loop
until != whileNo, the while block would be the same as repeat until. Exactly the same except for the names. while loop solutionrepeat until <not <condition>>
end
Just saying what the OP said….
So instead of the block saying “repeat” it will say “For” and instead of the block saying “repeat until” it will say “While”
The blocks will work the same but just have different names.
- stickfiregames
-
1000+ posts
While Loop and For Loop
For already exists, but it was removed for some reason.
http://scratch.mit.edu/projects/25582648/
It would be nice to have a proper for loop, where you can reference the iteration number.
While is not the same thing as Repeat Until, because While executes if the condition is true at the beginning of the loop, and Repeat Until executes if the condition is false at the end of the loop.
They could add a
http://scratch.mit.edu/projects/25582648/
It would be nice to have a proper for loop, where you can reference the iteration number.
While is not the same thing as Repeat Until, because While executes if the condition is true at the beginning of the loop, and Repeat Until executes if the condition is false at the end of the loop.
They could add a
repeat while <> :: control cstartbut people might confuse it with repeat until.
end
- stickfiregames
-
1000+ posts
While Loop and For Loop
This is the actual workaround for while:
if <condition :: grey> then
repeat until <not <condition :: grey>>
...
end
end
- AonymousGuy
-
1000+ posts
While Loop and For Loop
This is the actual workaround for while: This is the actual workaround for while:if <condition :: grey> then
repeat until <not <condition :: grey>>
...
end
end
repeat until <not <condition :: grey>>The “if” part isn't needed - if the condition is true, then it will still run the loop. If it's false, the if still isn't necessary, because the repeat until is evaluated as true, and thus cancels.
...
end
- stickfiregames
-
1000+ posts
While Loop and For Loop
This is the actual workaround for while: This is the actual workaround for while:if <condition :: grey> then
repeat until <not <condition :: grey>>
...
end
endrepeat until <not <condition :: grey>>The “if” part isn't needed - if the condition is true, then it will still run the loop. If it's false, the if still isn't necessary, because the repeat until is evaluated as true, and thus cancels.
...
end
Repeat until is evaluated at the end of the loop. That is why the if <condition> is needed: without it, the loop will run once even if the condition is false.
Last edited by stickfiregames (Aug. 30, 2014 14:28:13)
- wag123
-
21 posts
While Loop and For Loop
when this sprite clicked
if <you want a follow> then
go to [my profile v]
ask [for a follow] and wait
end
Last edited by wag123 (Feb. 15, 2015 03:31:38)
- Gaza101
-
500+ posts
While Loop and For Loop
Please stick to the topic. when this sprite clickedif <you want a follow> then
go to [my profile v]
ask [for a follow] and wait
end
Last edited by Gaza101 (Feb. 15, 2015 12:41:56)
- Discussion Forums
- » Suggestions
-
» While Loop and For Loop