KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to evaluate the expression (a=10) || (rr=20) while the rr variable is not defined so typing rr in the ruby console before evaluating the previous expression returns rr NameError: undefined local variable or method `rr' for main:Object from (irb):1 from :0 When I write the expression (a=10) || (rr=20) it returns 10, and when I write rr afterwards it says nil (a=10) || (rr=20) rr # => nil so, why is this happening? Shouldn't rr be defined only if the second argument of the || operator is evaluated, which should be never based on the documentation?
Tags (comma-separated)
Save Edits
Cancel