Sebastian Hungerecker wrote: > Jason Lillywhite wrote: >> I want counter2 method to take the array "b" and do something with it > > There is no array b in your code. b is a number - I think you want the > array > result. > > HTH, > Sebastian Oh, you are right. Okay now I see what I need thanks to both of you. I need to set up an array that captures just b alone as shown in my new code below. My lesson from this is call stuff from other methods by calling the name of the method and it will get you the last statement of the method. BUT WHAT IF I WANT TO GET MULTIPLE ITEMS FROM THE 'counter' METHOD? This way only lets you get the last line from the method, but what if I wanted to grab a "result_b"? class MyArray def counter result = [] result_b = [] i = 0 a = 1 b = 0 while i <= 5 do a = a + 1 b = b +1.5 result << b.to_s + "\t" + a.to_s result_b << b i += 1 end result result_b # will return result_b to caller end def counter2 this_b = counter # capture the return value puts this_b.inject {|sum, element| sum+element} # total is returned to caller end end test = MyArray.new puts test.counter2 -- Posted via http://www.ruby-forum.com/.