Dan Zwell wrote:
> Jonathan --- wrote:
>> I have the following code:
>> 
>> words = []
>> 
>> while gets.chomp != ''
>>   words.push gets.chomp
>> end
> 
> Jonathan,
> 
> ruby reads another line each time you call gets or gets.chomp (or
> gets.anything). You need to cache the result of the call to gets(). I
> would write:
> 
> while line = gets.chomp && line != ""
>    words.push line
> end
> 
> Dan


Hi Dan,

thanks very much for the response.  The program does not seem to get to 
end when just the enter is pressed...
Im doing my best to understand...

Sorry to be so thick!

Thanks!


-- 
Posted via http://www.ruby-forum.com/.