On Mon, Nov 26, 2012 at 1:38 PM, Artem B. <lists / ruby-forum.com> wrote:
>> Why?
> It was be an exercise of learning guide :)
>
> Thanks, and what do you think about my code?

You are not sorting Arrays but Arrays which must be filled with
objects that respond to #[] and return items which can be compared
with #< (line 4).

I am not even sure that the sorting will work - at least with this input

words = %w{cb ca b a}

you won't get a regular order:

["a", "b", "cb", "ca"]

That's because you sort by the first letter only.  You'll also get
wrong output with this input

words = ["", "z", "a"]

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/