Logic

If and case

A choice is an expression. else is required, and only the taken branch runs. 5 examples.

if condition then value else value. Both then and else are required. Only the branch you take is evaluated, so a division by zero on the other branch does not run. case is the same idea with more arms. Each arm is condition : value. else is required and may omit the colon. The first true arm wins. These are expressions, not separate statements. A missing else is a syntax error. Old does not run these. Interpreter and Compiler do.

if

y is 3. The else branch is not evaluated.

case

y is 1. An arm after else is a syntax error.

The binomial examples below are products. The interpolation example is the if. When j and i are the same index, that branch is 1, so the sheet never divides by zero. The Hilbert matrix on Matrices is a case.

Binomial theorem

C(n, 0) is an empty product, so it is 1. The two ways of writing (1 + x)^n agree exactly.

A binomial distribution

The probabilities add to 1. The mean is n p.

Lagrange interpolation

At a sample point the result is the sample, so y is 3. The branch j = i is 1, and the division by zero is never evaluated.

© 2026 QED Solverworks LLC