If Expression

if-expression ::= 'if' expression block-expression if-expression-else?
if-expression-else ::= 'else' block-expression

Evaluates the expression (the condition). If the result tests as truthy, the first block-expression (the then body) is evaluated. Otherwise, if an if-expression-else clause is present, the second block-expression (the else body) is evaluated.

The whole expression results in one of the following values, in order:

  1. The result of the then body.

  2. The result of the else body, if an if-expression-else is present.

Truthiness

Almost all values are considered truthy, with the following exceptions:

Last updated

Copyright © Vezel Contributors