From 5701b4084e7bdcd64b6a940c95d41888734f5ca6 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 25 Apr 2022 23:49:58 +0900 Subject: [DOC] mention assignment expression values --- doc/syntax/assignment.rdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/syntax/assignment.rdoc b/doc/syntax/assignment.rdoc index a1806e4c48..1321bbf3ac 100644 --- a/doc/syntax/assignment.rdoc +++ b/doc/syntax/assignment.rdoc @@ -8,6 +8,9 @@ example assigns the number five to the local variable +v+: Assignment creates a local variable if the variable was not previously referenced. +An assignment expression result is always the assigned value, including +{assignment methods}[rdoc-ref:syntax/assignment.rdoc@Assignment+Methods]. + == Local Variable Names A local variable name must start with a lowercase US-ASCII letter or a @@ -342,6 +345,9 @@ This prints: local_variables: @value: 42 +Note that the value returned by an assignment method is ignored whatever, +since an assignment expression result is always the assignment value. + == Abbreviated Assignment You can mix several of the operators and assignment. To add 1 to an object -- cgit v1.2.3