holloway.me

I wrote a tiny, elegant program in Ruby. It presents a prompt where you can enter any number of strings, and when you’re done it returns those strings back to you in alphabetical order.

    array = []
    item = nil

    while item != ''
        item = gets.chomp
        array.push item
    end

    puts array.sort

Hey, it’s not much, but it’s progress. Anyone know how to make this code more efficient?