Search Results

Search found 2 results on 1 pages for 'user257797'.

Page 1/1 | 1 

  • Understanding ruby array sort

    - by user257797
    I am having a problem understanding how array.sort{|x,y| block} works exactly,hence how to use it? ruby-doc example: a = [ "d", "a", "e", "c", "b" ] a.sort #=> ["a", "b", "c", "d", "e"] a.sort {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"] thanks

    Read the article

1