Update syntax-if-expression.md

Add a note that only one expression is evaluated in `if-expr`.
This commit is contained in:
Arseny Kapoulkine 2021-09-22 14:08:37 -07:00 committed by GitHub
parent 341afd9f63
commit 1788de56a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ To solve these problems, we propose introducing a first-class ternary conditiona
Concretely, the `if-then-else` expression must match `if <expr> then <expr> else <expr>`; it can also contain an arbitrary number of `elseif` clauses, like `if <expr> then <expr> elseif <expr> then <expr> else <expr>`. Note that in either case, `else` is mandatory.
The result of the expression is the then-expression when condition is truthful (not `nil` or `false`) and else-expression otherwise.
The result of the expression is the then-expression when condition is truthful (not `nil` or `false`) and else-expression otherwise. Only one of the two possible resulting expressions is evaluated.
Example: