18,700
edits
(→fork: clarifying why no-fork call to nonexistent function doesn't crash; it's not a "fork" bug, really) |
(→if: I'm not so sure anymore that this bug still exists; I am not seeing it in my tests) |
||
Line 136: | Line 136: | ||
if (7 - 8) # evaluates to true because it is non-zero | if (7 - 8) # evaluates to true because it is non-zero | ||
Be aware that BSL does not always respect scope for blocks of code under "if" statements; | Be aware that BSL does not always respect scope for blocks of code under "if" statements; for instance, a "return" statement will fire even if the surrounding "if" condition is false (see [[#Flow interrupt|Flow interrupt]] for an example). According to a note in neuro_level_logic.bsl, this may happen for variable assignments too. The workaround Bungie West used in that script for setting a variable conditionally was to make the variable global, and under the "if" statement call a function that modified that variable, since function calls will not fire unless the "if" condition is true. | ||
The logical operators "and" and "or" can be used to string together multiple conditions: | The logical operators "and" and "or" can be used to string together multiple conditions: |