395
edits
Philosopher (talk | contribs) m (→if ... then ... else: cleanup) |
Philosopher (talk | contribs) (→if ... then ... else: whoops, bad heading levels) |
||
Line 79: | Line 79: | ||
Actions can be arbitrary Nasal expressions, including function calls and other conditional blocks. | Actions can be arbitrary Nasal expressions, including function calls and other conditional blocks. | ||
== An example == | ==== An example ==== | ||
Lets say that if x is less than 5 we want to add 2 to it. We write: | Lets say that if x is less than 5 we want to add 2 to it. We write: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
Line 176: | Line 176: | ||
But the advantage is that we are forced to write out each condition exactly as it should be tested. Easier to understand and easier to maintain. | But the advantage is that we are forced to write out each condition exactly as it should be tested. Easier to understand and easier to maintain. | ||
== Another example == | ==== Another example ==== | ||
Lets say that you want something to happen only if the gear is up. But the only property you can read is GearDown. Then you write | Lets say that you want something to happen only if the gear is up. But the only property you can read is GearDown. Then you write | ||
Line 184: | Line 184: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The ! means not. So it translates as: If the gear is not down perform action. | The ! means not. So it translates as: If the gear is not down perform action. |
edits