On Mon, Nov 26, 2012 at 1:38 PM, Artem B. <[email protected]> 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/
-- You received this message because you are subscribed to the Google Groups
ruby-talk-google group. To post to this group, send email to
[email protected]. To unsubscribe from this group, send email
to [email protected]. For more options, visit this
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en