(Redirected from Forever If ())

Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.
Forever If ()
forever if <> {
} @loopArrow:: control cap
Category Control
Type C
Introduced in 11Dec06 (1.0 beta)
Removed in v230 (2.0 beta)

The Forever If () block was a Control block and a C block. The block would continuously check its Boolean condition. If the condition is true, the code held inside the block would run, and then the script continues, but if the condition is false, nothing would happen until it becomes true again. The block continuously runs in a loop; in fact, this block worked just like the If () block placed into the Forever block. This block was removed in a beta version of 2.0 because it confused many new Scratchers.[1]

Workaround

Main article: List of Block Workarounds

This block can be simulated with the following code:

forever
 if <. . .:: grey> then
  . . .
 end
end

or

forever
 wait until <. . .:: grey>
  . . .
end

or

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

When a project from Scratch 1.x is loaded into v230 of Scratch 2.0 or later, this block is automatically replaced with the first workaround.

Removal

Due to the block's simplicity to recreate, that it has less functionality than the replication (you cannot stack multiple If () blocks inside the Forever If () block), and that new Scratchers sometimes confuse it with the Repeat Until () block, there had been many campaigns to remove the block.[2][3] Eventually in 2.0, the block was removed.

Despite the simple workaround, multiple users have suggested the block be brought back,[4][5] because it seems more natural to use for those newer to programming.[6] However, this has been officially rejected by the Scratch Team.[7]

Using the workaround gives an advantage too — you can place multiple If () statements (and If () Then, Else statements, and even other blocks) in the Forever loop. An example:

forever
 if <key (1 v) pressed?> then
  set [Page v] to (1)
 end
 if <key (2 v) pressed?> then
  set [Page v] to (2)
 end
 if <key (space v) pressed?> then
  broadcast (Render v)
 end
end

Example Uses

Some common uses of the block were:


when gf clicked:: control
forever if <loud?:: sensing> {
    say [Shh... do not wake anyone up.]
} @loopArrow:: control cap
  • Simple cases where there only needed to be one If () block in a Forever block, so the Forever If () was used instead
forever if <(x position) > [10]> {
    hide
} @loopArrow:: control cap

See Also

References

  1. Paddle2See. (May 9 2020). "Actually, it wasn't removed because it had an easy workaround. It was removed because many beginning Scratchers found it overly confusing." post:4034761
  2. ar-topic:25927
  3. http://web.archive.org/web/20121202170930/http://suggest.scratch.mit.edu/forums/60449-suggestions/suggestions/1395003-delete-forever-if
  4. topic:9989
  5. topic:20438
  6. topic:30138
  7. post:4034761
Cookies help us deliver our services. By using our services, you agree to our use of cookies.