Conditional Expression
Internally if/else desugars to a match expression. See syntax sugar for more information.
The if
expression provides a simple control flow mechanism to
chose between two branches. Its use is straightforward:
A conditional expression can form the else
clause of a previous
conditional expression:
Singeline If Expressions
Keyword then
is often required in single-line if-expressions: