[DOC] Change local method to local variable in assignment docs
This commit is contained in:
parent
8fded5f5d1
commit
93bb415516
Notes:
git
2023-01-23 02:49:04 +00:00
Merged: https://github.com/ruby/ruby/pull/7173 Merged-By: nobu <nobu@ruby-lang.org>
@ -107,7 +107,7 @@ Rather than printing "true" you receive a NameError, "undefined local variable
|
|||||||
or method `a'". Since ruby parses the bare +a+ left of the +if+ first and has
|
or method `a'". Since ruby parses the bare +a+ left of the +if+ first and has
|
||||||
not yet seen an assignment to +a+ it assumes you wish to call a method. Ruby
|
not yet seen an assignment to +a+ it assumes you wish to call a method. Ruby
|
||||||
then sees the assignment to +a+ and will assume you are referencing a local
|
then sees the assignment to +a+ and will assume you are referencing a local
|
||||||
method.
|
variable.
|
||||||
|
|
||||||
The confusion comes from the out-of-order execution of the expression. First
|
The confusion comes from the out-of-order execution of the expression. First
|
||||||
the local variable is assigned-to then you attempt to call a nonexistent
|
the local variable is assigned-to then you attempt to call a nonexistent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user