If condition: Difference between revisions
(Created page with "'''if'''('condition','true','false') - Returns 'true'-statement if logical 'condition'-statement is true (non-zero), 'false'-statement otherwise. '''Advice: Choose it from the Programming palette''' 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. File:Programming_if1.png The user should take care when de...") |
No edit summary |
||
Line 5: | Line 5: | ||
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. | 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. | ||
[[File: | [[File:En_programming_if1.png]] | ||
The user should take care when defining a function which uses "if". The Boolean 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. | The user should take care when defining a function which uses "if". The Boolean 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. | ||
[[File: | [[File:En_programming_if2.png]] | ||
It is advisable to see the tooltip and the order (precedence) of operators. The operators are usually calculated from left to right. Use ( ) - parenthesis if you have some doubts. | It is advisable to see the tooltip and the order (precedence) of operators. The operators are usually calculated from left to right. Use ( ) - parenthesis if you have some doubts. | ||
[[File: | [[File:En_programming_if3.png]] | ||
Latest revision as of 12:17, 12 September 2024
if('condition','true','false') - Returns 'true'-statement if logical 'condition'-statement is true (non-zero), 'false'-statement otherwise.
Advice: Choose it from the Programming palette
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.
The user should take care when defining a function which uses "if". The Boolean 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.
It is advisable to see the tooltip and the order (precedence) of operators. The operators are usually calculated from left to right. Use ( ) - parenthesis if you have some doubts.
This page is inspired by legacy wiki article https://smath.info/wiki/if.ashx.