Ruby noob, studying the ropes. I am currently experiencing this tutorial and working on this exercise:
Let me write a program that asks us to enter as many words as we want (one word per line, continuing until we just press Enter on an empty line), and which then repeats the words back to us in alphabetical order.
Now I ignore the part in alphabetical order.
Here is my code:
puts 'Hi, do you need something sorted?'
yn = gets.chomp
while yn != 'no'
puts 'What else?'
array = [gets]
yn = gets.chomp
end
puts 'Here\ what you told me: ' +array.to_s
I fixed it in a few hours. To prevent your laptop from breaking due to frustration, I take a break. Can anyone with more experience and possibly more patience point out my mistakes?
source
share