Condition expression

Info about design forms features
PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

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 369 times
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

Return to “Design forms features”

Who is online

Users browsing this forum: No registered users and 4 guests