Trash Can.svg The block documented in this article is a hidden block, meaning that while it technically still exists in the latest version of Scratch (3.0), it is not available in the palette.
While ()
while <> {
}:: #c3af00
Category Experimental (in 2.0), Control (in 3.0)
Type C
while <> {
}@loopArrow:: control
The While () block in Scratch 3.0.

The while () block was a C block and an experimental block. Blocks held inside this block will loop until the specified boolean statement is false, in which case any code beneath the block will execute. Like all of the other experimental blocks in Scratch 2.0, it was a hidden block, meaning it could not be accessed via the block palette.

This block is still present in Scratch 3.0 as a hidden block, and its functionality was kept intact. Additionally, the block was moved to the Control category, and had a loop arrow added to the end of the block.

Workaround

Main article: List of Block Workarounds

This block's functionality can still be accessed with the following workaround:

repeat until <not<. . .:: grey>>
    . . .
end

Example Uses

Due to how similar this block is with the repeat until () block, the two blocks share many example uses:

  • Moving a sprite until its X or Y position is at a certain amount

while <not <(x position) = (100)>> {
    move (10) steps
}:: #c3af00
  • Having a sprite stick to the mouse until the mouse is not down

while <mouse down> {
    go to [mouse pointer v]
}:: #c3af00


reset timer
while <(timer) < (limit)> {
. . .:: grey
}:: #c3af00

Cookies help us deliver our services. By using our services, you agree to our use of cookies.