(→‎Removal: {{cn}})
m (Added references)
Line 27: Line 27:
 
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)|Repeat Until ()]] block, there have been many campaigns to remove the block.<ref>{{Forum Archive|25927}}</ref><ref>http://suggest.scratch.mit.edu/forums/60449-suggestions/suggestions/1395003-delete-forever-if</ref>  Eventually in 2.0, the block was removed. The block had an advantage, though: it runs some milliseconds faster than its replication, so it could be used to combat extreme lag.
 
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)|Repeat Until ()]] block, there have been many campaigns to remove the block.<ref>{{Forum Archive|25927}}</ref><ref>http://suggest.scratch.mit.edu/forums/60449-suggestions/suggestions/1395003-delete-forever-if</ref>  Eventually in 2.0, the block was removed. The block had an advantage, though: it runs some milliseconds faster than its replication, so it could be used to combat extreme lag.
  
Despite the simple workaround, multiple users have suggested the block be brought back, because it seems more natural to use for those newer to programming.{{cn}}
+
Despite the simple workaround, multiple users have suggested the block be brought back<ref>http://scratch.mit.edu/discuss/topic/9989/</ref><ref>http://scratch.mit.edu/discuss/topic/20438/?page=1</ref>, because it seems more natural to use for those newer to programming.<ref>http://scratch.mit.edu/discuss/topic/30138/</ref>
  
 
Using the workaround gives an advantage too {{-}} you can place multiple If () statements (and [[If () Then, Else (block)|If () Then, Else]] statements, and even other blocks) in the Forever loop. An example:
 
Using the workaround gives an advantage too {{-}} you can place multiple If () statements (and [[If () Then, Else (block)|If () Then, Else]] statements, and even other blocks) in the Forever loop. An example:

Revision as of 18:04, 19 June 2014

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 ().png
Category Control
Type C
Introduced in 1.0
Removed in 2.0
The block in Scratch 2.0 before its removal.

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. After being removed, this block is replaced with its workaround.

Workaround

Main article: List of Block Workarounds

This block can be replicated with the following code:

forever
 if <condition goes here> then
  . . .
 end
end

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 have been many campaigns to remove the block.[1][2] Eventually in 2.0, the block was removed. The block had an advantage, though: it runs some milliseconds faster than its replication, so it could be used to combat extreme lag.

Despite the simple workaround, multiple users have suggested the block be brought back[3][4], because it seems more natural to use for those newer to programming.[5]

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

In Scratch 2.0, this block has been removed. Uploading a project from Scratch 1.4 that contains the block will cause it to transform into its replication.

Example Uses

Due to its unpopularity, the block is not widely used. Some common uses, however, are:

  • Reducing lag
  • Swift script construction
  • Simple cases where there only needs to be one If () block in a Forever block, so the Forever If () is used instead
  • To save time; instead of using multiple blocks to create the code you only needed one
when gf clicked
forever if <(loudness) > [30]>
say [Shh... don't wake anyone up.]

See Also


References

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