What's wrong with my code?

So I am reading ’ Learn to Program’ by Chris P… One of the exercises
there is to build and sort an array.

This is the question: Write the program we talked about at the beginning
of this chapter, one that asks us to type as many words as we want (one
word per line, continuing until we just press Enter on an empty line)
and then repeats the words back to us in alphabetical order. Make sure
to test your program thoroughly; for example, does hitting Enter on an
empty line always exit your program? Even on the first line? And the
second? Hint: There’s a lovely array method that will give you a sorted
version of an array: sort. Use it!

And this is my attempt

random_words = []
input = gets.chomp

while input!=’’
puts 'Type any word you want: ’
input = gets.chomp
random_words.push input
puts random_things.sort

So it does give me a list when I hit ENTER on empty line. The only
problem is that the list never includes the first word I type. (i.e. if
I typed ‘Flower’ on the first line, ‘Flower’ never shows up on the
sorted list… can anybody explain that to me ?? Thanks

— Beginner beginner on Ruby.

The problem is with line 7

random_words.push input

What you are doing is passing input as an argument to the push method.

Ruby, like Java and C, follows this pattern for passing arguments to


whereby the argument is passed to a pair of brackets directly after the
method call.

Can you figure it out from here?