Page History: if structure
Compare Page Revisions
Page Revision: 2009/09/22 09:37
if('condition','true','false') - Returns 'true'-statement if logical 'condition'-statement is true (non-zero), 'false'-statement otherwise.
The "if" programming tool returns a value depending on Boolean 'condition'. Boolean condition can be formed by using Boolean palette. Here is a simple example, returning
numeric or
symbolic result.
using if |
It should take care when defining a function which uses "if". The Booelan condition could be sometimes quite "tricky". For example, if we want to find out if the y-value is inside (x,z) range we could do something like this.
value insite the interval - wrong! |
It is advisable to see the tooltip and the order (precedence) of operators. The operators are usualy calculated from left to right. Use ( ) - parenthesis if you are have some doubts.
value inside interval - good! |