[DOC] Change local method to local variable in assignment docs

This commit is contained in:
Talal Al-Humaidi 2023-01-23 02:48:44 +00:00 committed by GitHub
parent 8fded5f5d1
commit 93bb415516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>

View File

@ -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
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
method.
variable.
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