J
Jonathan ---
I have the following code:
words = []
while gets.chomp != ''
words.push gets.chomp
end
puts words.sort
Its supposed to capture from the user, a bunch of words, until just
enter is pressed, and put them in an array. When I run the code, it
only enters every other word i type into the array. I cannot figure it
out! I know this is simple for you all, so have pity on me! Im super
new to ruby and programming in general.
Thanks in advance.
J
words = []
while gets.chomp != ''
words.push gets.chomp
end
puts words.sort
Its supposed to capture from the user, a bunch of words, until just
enter is pressed, and put them in an array. When I run the code, it
only enters every other word i type into the array. I cannot figure it
out! I know this is simple for you all, so have pity on me! Im super
new to ruby and programming in general.
Thanks in advance.
J