|
Expressions |
Top Previous Next |
|
Value Expressions Problem descriptors can contain expressions made of one or more operators, variables, defined values and pairs of parentheses that evaluate to numerical constants. In evaluating value expressions, FlexPDE follows the algebraic rules of precedence in which unary operators are evaluated first, followed by binary operators in the following order:
power multiplication and division addition and subtraction relational operators (<, <=, =, <>, >=, >) relational combinations (AND, OR)
When included in expressions, subexpressions enclosed in pairs of parentheses are evaluated first, without regard to the precedence of any operators which precede or follow them. Parentheses may be nested to any level, with inner subexpressions being evaluated first and proceeding outward. Parentheses must always be used in pairs.
Conditional-Value Expressions Problem descriptors can contain conditional expressions of the form
IF condition THEN subexpression ELSE subexpression .
This form selects one of the two alternative values as the value of the expression. It is used in expressions like "y = IF a THEN b ELSE c", analogous to the expression "y = a ? b : c" in the C programming language.
It is not the procedural alternative construct "IF a THEN y=b ELSE y=c" familiar in procedural programming languages.
The THEN or ELSE subexpressions my contain nested IF...THEN...ELSE expressions. Each ELSE will bind to the nearest previous IF.
|