In most programming languages, there is a "while" loop that runs code while a condition is true. However, in Scratch, there is only a "repeat until" loop that repeats until a condition is true. How do I simulate a "while" loop in Scratch?
Asked
Active
Viewed 1,332 times
2 Answers
4
Say you wanted to use a "while" loop to run while "ConditionA" is true.
WHILE ConditionA
Say "hello"
In Scratch, you can use a "repeat until" loop in this way:
REPEAT UNTIL NOT ConditionA
Say "hello"

CatPerson
- 137
- 7
1
This is easy. Just loop an "if" operator.
forever
if <...>
code goes here
else
end
end

Aetinx
- 51
- 1
- 10