From: Siep Korteling Date: 2010-01-20T06:18:07+09:00 Subject: Re: Newbie needs help getting started Cary Swoveland wrote: ... > One easy tech question follow. > > class Node > attr_reader :row > def initialize(r) > row = r > end > end > > n = Node.new(0) > puts "n = #{n}" > > I expected > n = 0 > but instead, Ruby says > n = # > ? > > Cary You probably want to print n.row , which returns nil in your code because of a previous error: row = r should be @row = r. When I was really new to ruby it paid off to write out the setters and getters by hand. It got boring so fast I happily switched to the attr_accessor tricks, but with better understanding. hth, Siep -- Posted via http://www.ruby-forum.com/.