Clarify that the conditional expression is the one under discussion

Rather than the return expression.

Fixes #3168.
This commit is contained in:
Carol (Nichols || Goulding)
2022-10-28 16:38:54 -04:00
committed by Carol (Nichols || Goulding)
parent bb7e429ad6
commit 3962c0224b

View File

@@ -31,10 +31,10 @@ the variants of the enum as its patterns</span>
Lets break down the `match` in the `value_in_cents` function. First we list
the `match` keyword followed by an expression, which in this case is the value
`coin`. This seems very similar to an expression used with `if`, but theres a
big difference: with `if`, the expression needs to return a Boolean value, but
here it can return any type. The type of `coin` in this example is the `Coin`
enum that we defined on the first line.
`coin`. This seems very similar to a conditional expression used with `if`, but
theres a big difference: with `if`, the condition needs to evaluate to a
Boolean value, but here it can be any type. The type of `coin` in this example
is the `Coin` enum that we defined on the first line.
Next are the `match` arms. An arm has two parts: a pattern and some code. The
first arm here has a pattern that is the value `Coin::Penny` and then the `=>`