Merge pull request #3870 from rust-lang/fix-2980

Clarify function definitions vs. expressions
This commit is contained in:
Chris Krycho
2024-07-23 08:12:54 -06:00
committed by GitHub
+2 -1
View File
@@ -125,7 +125,8 @@ assigning a value to it with the `let` keyword is a statement. In Listing 3-1,
</Listing>
Function definitions are also statements; the entire preceding example is a
statement in itself.
statement in itself. (As we will see below, *calling* a function is not a
statement.)
Statements do not return values. Therefore, you can’t assign a `let` statement
to another variable, as the following code tries to do; you’ll get an error: