927 B
927 B
Arithmetic Expression
Decodal supports arithmetic over concrete numeric values.
{
workers = 2 + 2;
timeout = 30.0 / 2;
port = 8000 + 80;
negative = -1;
}
Operators
+addition-subtraction*multiplication/division- unary
-negation
* and / bind tighter than + and -.
Parentheses can be used to make grouping explicit.
2 + 3 * 4 # 14
(2 + 3) * 4 # 20
Numeric behavior
Arithmetic requires concrete Int or Float operands.
Int + Int, Int - Int, and Int * Int produce Int when no overflow occurs.
Mixed Int / Float arithmetic produces Float.
Division always produces Float.
Division by zero and integer overflow are evaluation errors.
Arithmetic expressions can be used anywhere a concrete numeric expression is expected, including defaults and numeric constraints.
port = Int & > 4000 + 42 default 8080;