From: John Sheahan Date: 2007-12-03T04:02:41+09:00 Subject: Re: Running -r in IRB Makes sense, Sebastian....thanks for the input. I guess the example in the book was just suppose to be showing me how to include a class in irb and explain some code without being able to run the code and get the output....kind of wierd but I get the point they are trying to make thanks to you. I really appreciate your help with these basic questions....I'm kind of a slow learner when it comes to code jackster Sebastian Hungerecker wrote: > John Sheahan wrote: >> irb(main):011:0> other_wall=Wall.new(10) >> => # >> irb(main):012:0> >> >> I'm wondering why I don't get the program to run and count the 99 >> bottles of beer starting with 10 in this case? > > Because nothing in your initialize method does that. > Wall.new(10) creates a new Wall object and calls its initialize method > with > the paramter 10. Since your initialize method is defined as follows: > > def initialize(num_of_bottles) > @bottles = num_of_bottles > end > > Wall.new(10) will return a Wall object whose @bottles instance variable > has > been set to 10. It won't do anything more than that because it hasn't > been > told to do anything more. > > > HTH, > Sebastian -- Posted via http://www.ruby-forum.com/.