Thanks Jeffrey,
I hadn't been told about break yet. I know if / else would have worked
in it's place.

Stuart



On 6/23/06, Jeffrey Moss <jeff / opendbms.com> wrote:
> Problem is you're calling gets way too much.
>
> compare this working code to your own:
>
> $stdout.sync = true
>
> myarray = []
>
> while (another = gets.chomp)
>   break if another.empty?
>   myarray.push(another)
>   print another.inspect
> end
>
> print myarray.inspect
>
> myarray.each do |mine|
> puts mine
> end
>
> On Sat, Jun 24, 2006 at 03:27:49AM +0900, Dark Ambient wrote:
> > Well, I can't believe that I'm back already with another question.
> > Don't fret, only a few more chapters in this book to go :)
> >
> > My task is to loop through a "gets" and end the program by just doing
> > an empty, no input, just enter. The purpose is too add x elements to
> > an array.  Problem though is the print out is showing only the last
> > element entered.  I know from looking at other languages there was
> > usually an incrementer.  Still, using .push I'd expect the slots to
> > continue to fill up, maybe a wrong perception.
> >
> > $stdout.sync = true
> >
> > myarray = []
> > another = gets.chomp
> >
> > while gets.chomp != ''
> > another = gets.chomp
> > myarray.push(another)
> > end
> >
> > myarray.each do |mine|
> > puts mine
> > end
> >
> > TIA
> > Stuart
> >
>
>