On Aug 17, 3:49 am, "Robert Klemme" <shortcut... / googlemail.com>
wrote:
> I'd rather do this because the test is much easier:
>
> words = []
>
> while ( line = gets )
>   words << line.chomp
> end

The original poster wants the loop to end when the user presses
<Enter>
without entering any text.  How about this?

words = []
while line = gets  and  line.chomp! != ""
  words << line
end