From: Robert Klemme Date: 2012-03-18T21:51:25+09:00 Subject: Re: Sorting Algorithm Jan E. wrote in post #1051969: > array.push unsortedarray[0..unsortedarray.length] > > does not what you expect. It does not append the elements of > "unsortedarray" to "array" but rather "unsortedarray" itself. So after > the first run of the inner while loop you end up with array == [['a', > 'b', 'c', 'd']]. And this will break your algorithm. > > Since you want the *elements* appended, you have to unpack > "unsortedarray" first: > > array.push *unsortedarray Another variant to achieve this without unpacking uses Array#concat: array.concat unsortedarray Kind regards robert -- Posted via http://www.ruby-forum.com/.