m (Added part about users wanting block back)
m (→‎Removal: more formal wording about rejection)
 
(40 intermediate revisions by 25 users not shown)
Line 1: Line 1:
 
{{obsolete feature}}
 
{{obsolete feature}}
{{Block
+
{{block
 
|name = Forever If ()
 
|name = Forever If ()
|image = Image:Forever_if_().png
+
|image = forever if <> :: control
 +
|sb = 2.0
 
|imagewidth = 116px
 
|imagewidth = 116px
 
|category = [[Control Blocks|Control]]
 
|category = [[Control Blocks|Control]]
|type = [[C Blocks|C]]
+
|type = [[C Block|C]]
 
|added = 1.0
 
|added = 1.0
 
|removed = 2.0
 
|removed = 2.0
 
}}
 
}}
[[File:2.0 Forever If ().png|thumb|The block in Scratch 2.0 before its removal.]]
 
 
The '''Forever If ()''' [[Blocks|block]] was a [[Control Blocks|Control block]] and a [[C Block|C block]]. The block would continuously check its [[Boolean Block|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 () Then (block)|If ()]] block placed into the [[Forever (block)|Forever]] block. After being removed, this block is replaced with its workaround.
 
The '''Forever If ()''' [[Blocks|block]] was a [[Control Blocks|Control block]] and a [[C Block|C block]]. The block would continuously check its [[Boolean Block|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 () Then (block)|If ()]] block placed into the [[Forever (block)|Forever]] block. After being removed, this block is replaced with its workaround.
  
==Workaround==
+
== Workaround ==
 
{{main|List of Block Workarounds}}
 
{{main|List of Block Workarounds}}
This block can be replicated with the following code:
+
This block can be simulated with the following code:
  
 
<scratchblocks>
 
<scratchblocks>
 
forever
 
forever
  if <condition goes here> then
+
  if <... :: grey> then
 
   . . .
 
   . . .
 
  end
 
  end
 
end
 
end
 
</scratchblocks>
 
</scratchblocks>
 +
or
 +
<scratchblocks>
 +
forever
 +
wait until <... :: grey>
 +
  . . .
 +
end
 +
</scratchblocks>
 +
or
 +
<scratchblocks>
 +
forever
 +
repeat until <not <... :: grey>>
 +
  . . .
 +
end
 +
end
 +
</scratchblocks>
 +
 +
When a project from Scratch 1.X is loaded into Scratch 2.0, this block is automatically replaced with the first workaround.
  
===Removal===
+
==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)|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<ref>[[post:4034761]]</ref>, there had been many campaigns to remove the block.<ref>[[ar-topic:25927]]</ref><ref>http://suggest.scratch.mit.edu/forums/60449-suggestions/suggestions/1395003-delete-forever-if{{dead link}}</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.
+
Despite the simple workaround, multiple users have suggested the block be brought back,<ref>[[topic:9989]]</ref><ref>[[topic:20438]]</ref> because it seems more natural to use for those newer to programming.<ref>[[topic:30138]]</ref> However, this has been officially rejected by the [[Scratch Team]].<ref>[[post:4034761]]</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:
Line 45: Line 62:
 
</scratchblocks>
 
</scratchblocks>
  
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 ==
 +
Some common uses of the block were:
 +
 
 +
* Reducing lag {{cn|date=July 2020}}
 +
<scratchblocks version=2.0>
 +
forever if <(size) > [100]> :: control
 +
. . . // laggy script
 +
</scratchblocks>
 +
* Swift [[script]] construction
 +
<scratchblocks version=2.0>
 +
when gf clicked
 +
forever if <loud?::sensing> ::control
 +
say [Shh... do not wake anyone up.]
 +
</scratchblocks>
 +
* Simple cases where there only needed to be one If () block in a Forever block, so the Forever If () was used instead
 +
<scratchblocks version=2.0>
 +
forever if <(x position) > [10]> :: control
 +
hide
 +
</scratchblocks>
  
==Example Uses==
+
== See Also ==
Due to its unpopularity, the block is not widely used. Some common uses, however, are:
+
* [[Forever (block)|Forever]]
*Reducing lag
+
* [[If () Then (block)|If ()]]
*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
 
  
<scratchblocks>
+
== References ==
when gf clicked
+
<references/>
forever if <(loudness) > [30]>
 
say [Shh... don't wake anyone up.]</scratchblocks>
 
  
==See Also==
 
*[[Forever (block)|Forever]]
 
*[[If () Then (block)|If ()]]
 
 
{{Control Blocks}}{{Removed Blocks}}
 
{{Control Blocks}}{{Removed Blocks}}
 +
 
[[Category:Control Blocks]]
 
[[Category:Control Blocks]]
 
[[de:Wiederhole fortlaufend, falls () (Block)]]
 
[[de:Wiederhole fortlaufend, falls () (Block)]]
 
+
[[ja:もし () なら、ずっと (ブロック)]]
 
 
==References==
 
<references/>
 

Latest revision as of 02:41, 20 February 2021

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 <> :: control
Category Control
Type C
Introduced in 1.0
Removed in 2.0

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 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 Scratch 2.0, 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[1], there had been many campaigns to remove the block.[2][3] 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,[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:

forever if <(size) > [100]> :: control
. . . // laggy script
when gf clicked
forever if <loud?::sensing> ::control
say [Shh... do not wake anyone up.]
  • 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]> :: control
hide

See Also

References

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