Re: not understanding return statement

Ken D'Ambrosio <[email protected]>
Newsgroups gmane.comp.lang.ruby.general
Message-ID <[email protected]>
On 2018-12-12 06:15, Andy Jones wrote:

> But it won't set the @root attribute on the class, which is what you are reading when you say `p x.root`.  @root is an attribute on the class BinarySearchTree; root is a variable in the insert method. They are not the same thing.

 To be fair, having @root (from class Foo) == foo.root, where "root" in
class Foo does *not*, is somewhat counterintuitive.  I think it's a most
excellent thing, but it does lead to confusion among those learning
about attr_* useage. 

$.02, 

-Ken


Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.