From: Mike Stephens Date: 2011-01-18T22:06:16+09:00 Subject: Re: Calling by Reference - Two Questions Josh Cheek wrote > def ary.swap > new_contents = [ self[1] , self[0] ] > replace new_contents > end That kind of just moves the question on to how does replace work. But thank you for showing me replace, and even more for opening my eyes to an exciting world of singletons. > > def ary.my_reverse > lower , higher = 0 , size-1 > while lower < higher > self[lower] , self[higher] = self[higher] , self[lower] > lower += 1 > higher -= 1 > end > self > end > That does work (and doesn't need the last self). It seems to agree with the Jesus rule, that you can assign to self but only component-by-component. I guess your answers give me everything I would ever need! -- Posted via http://www.ruby-forum.com/.