1 (true) or 0 (false); see Operators and precedence.
If [if]
comparison; returns true_statement if it is true, otherwise false_statement. Any expression can appear in any position, and if calls can be nested on either branch.
comparison uses one of the comparison operators:
Use
== (comparison) inside conditions, not = (assignment). See Operators and precedence.Combining conditions
Combine comparisons with&& (and), || (or), and ! (not). A good rule of thumb is to write the condition the way you would say it out loud.
>, <) and inclusive (>=, <=) comparisons differ exactly at the boundary value — choose deliberately.
Nesting handles more than two outcomes — here, a different result for “more than 10 over,” “1–10 over,” and “not over”:
Choose [choose]
index (starting with 1) — a shorthand for a chain of if statements. index must be a whole number from 1 to N, an expression that evaluates to a whole number, or a Parameter out of range error is returned.
Loop [loop]
expression from from to to, building a table with one row per iteration. It increments by 1 (or by step, decrementing when to is below from), and ends when the index passes to. Two special variables are available inside the expression:
index— the current value of the loop counter. It starts atfromand advances bystep, so the defaultloop(1; n)runs1, 2, … nwhileloop(1; 5; 2)runs1, 3, 5.last— the value from the previous iteration (0on the first).
index or last is ignored in favor of the loop’s own.
Building a series
Two loop patterns recur when projecting values over time. Compound growth — a value that grows at a fixed rate each period from a first-period base:index - 1 exponent holds the first period at base (^ 0 is 1), and ceil guards against a fractional periods. The result is one row per period.
Running total — a cumulative sum across an existing table, with last as the accumulator:
item(result; length(result)) — is the all-up total. See item and length in Table functions.
