From 0a626ce599bcae4fa1a48535c0883beaca38f4db Mon Sep 17 00:00:00 2001 From: Taylor Yu Date: Tue, 4 May 2021 14:08:00 -0500 Subject: [PATCH] Explicitly state result of compound assignment The existing text implies but doesn't explicitly say that compound assignment produces the unit value. A reader could also infer it from the signatures of the compound assignment trait functions, but it seems better to be explicit. --- src/expressions/operator-expr.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/expressions/operator-expr.md b/src/expressions/operator-expr.md index 75f59636d..d5dd8d159 100644 --- a/src/expressions/operator-expr.md +++ b/src/expressions/operator-expr.md @@ -470,6 +470,8 @@ fn example() { } ``` +Like assignment expressions, compound assignment expressions always produce [the unit value][unit]. +
Warning: The evaluation order of operands swaps depending on the types of the operands: