Control flow
Calculeaf has two worksheet helpers for branching and looping. You cannot
define your own functions with name(...):=. Type these in a
math region; they are not ribbon buttons.
if
Type if(condition, then, else). Only the taken branch runs —
useful when the unused branch would be a unit error or a divide by zero.
util := 0.82
if(util > 1, "NG", "OK") =
Comparisons use the Compare group on the Math tab: =, ≠, <, >, ≤, ≥, ∧ (and), ∨ (or). The result can be a number, a quantity with units, or a short string. Conditional formatting can then colour a numeric result — see Conditional formatting.
while
while(name, initial, condition, update[, max_iter]) updates
name until the condition is false. Default
max_iter is 1000. The previous value of that name is restored
when the call finishes — the loop variable is local to the call.
while(i, 0, i < 10, i + 1) =
A later := with the same name still overwrites worksheet
scope. If the loop hits max_iter, the region shows an error
rather than hanging.