Difference between revisions of "If"

14 bytes removed ,  16:02, 13 December 2009
→‎Oblivion evaluates entire If statement: more code hardly ever causes lag in oblivion, removing statement
imported>Thalassicus
imported>Qazaaq
(→‎Oblivion evaluates entire If statement: more code hardly ever causes lag in oblivion, removing statement)
Line 80: Line 80:
=== Oblivion evaluates entire If statement ===
=== Oblivion evaluates entire If statement ===


Oblivion evaluates all the conditions for an IF statement. For example, when you combine expressions with "&&", if the first expression is false, later expressions will still be evaluated, even though they are irrelevant (false && anything = always false, true || anything = always true). This results in more code being processed than necessary, and more lag.
Oblivion evaluates all the conditions for an IF statement. For example, when you combine expressions with "&&", if the first expression is false, later expressions will still be evaluated, even though they are irrelevant (false && anything = always false, true || anything = always true). This results in more code being processed than necessary.


This can also result in unexpected errors, such as below:
This can also result in unexpected errors, such as below:
Anonymous user