Difference between revisions of "Complex formulas"
Jump to navigation
Jump to search
old>Admin |
old>Admin |
||
Line 38: | Line 38: | ||
Script code | Script code | ||
var result; | |||
if ( [NUMBER1] > [NUMBER2] ) { | |||
result = [NUMBER1] * 11; | |||
} | |||
else { | |||
result = [NUMBER3]; | |||
} | |||
return result; | |||
Expression | Expression | ||
( [NUMBER1] > [NUMBER2] ? [NUMBER1] * 11 : [NUMBER3] ) |
Revision as of 09:51, 22 May 2013
Common operators
- Add: +
- Subtract: -
- Division: /
- Multiply: *
- Modulus: %
- Precedence: ( ... )
Mathematical functions
- Absolute: abs
- Minimum: max
- Maximum: min
- Power: pow
- Square root: sqrt
- Logarithms: log log10 exp
Support for statements
IF statement
Syntax used matches JavaScript inline IF statments
( Value1 Operator Value2 ? ValueIfTrue : ValueIfFalse )
- Test
- First value or expression
- Operator
- Equal: =
- Unequal: !=
- Greater: > (>=)
- Lesser: < (<=)
- Second value or expression
- True/False values
- Value
- Expression
Examples
Script code
var result; if ( [NUMBER1] > [NUMBER2] ) { result = [NUMBER1] * 11; } else { result = [NUMBER3]; } return result;
Expression
( [NUMBER1] > [NUMBER2] ? [NUMBER1] * 11 : [NUMBER3] )