Condition expression

Info about design forms features
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable

Condition expression

Postby PetrS » 16 Jul 2014, 06:31

size=150Condition expression/size
Version 5.2.15 and higher

Conditional expression was implement in SDF. The conditional operator ( ? : ) returns one of two values depending on the value of a Boolean expression.

ubSyntax for the conditional operator:/b/u
i<condition> ? <first_expression> : <second_expression>/i

The condition must evaluate to true or false. If condition is true, first_expression is evaluated and becomes the result. If condition is false, second_expression is evaluated and becomes the result. Only one of the two expressions is evaluated.

You can express calculations that might otherwise require an if-else construction more concisely by using the conditional operator.

ubNote:/b/u
It is recommended to close the conditional expression in parentheses to make the code more readable.


See attached example for more info.
Attachments
ConditionExpression.cls
(24.17 KiB) Downloaded 214 times
Ing. Petr Slepicka

Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable

Return to “Design forms features”

Who is online

Users browsing this forum: No registered users and 5 guests