Sorry, meant to put this in the last reply.  One thing I noticed is
that by removing the method definition I can get the loop to work.  I
did change some of the verbage around though.
I commentd out the def method , and changed the end condition to
!='stop' but when I contain it in the method it no longer works.
Makes me wonder about methods.

#def sortwords

 # s_words = []
  #u_words = []


word = ''
while word != 'stop'
  puts 'Please enter a word to be sorted'
  word = gets.chomp.downcase
  #u_words.push['sort']

#end

end

Stuart

On 6/26/06, Dark Ambient <sambient / gmail.com> wrote:
> On 6/26/06, Matthew Smillie <M.B.Smillie / sms.ed.ac.uk> wrote:
> > On Jun 26, 2006, at 19:26, Dark Ambient wrote:
>
> > Your biggest problem in the code you put up is that you're using the
> > same variable for several different things: a (apparently redundant)
> > parameter to the method, a loop condition, and to hold user input -
> > it's much better, especially when you're learning to program, to use
> > separate variables for these separate concerns.
> >
> > There are several problems with the code, one of which is (again) the
> > bad choice of loop condition, observe your code stripped down to only
> > the bits which affect the loop continuing or not:
> >
> > sort = ''
> > while sort == ''
> >    sort = gets.etc.etc  # sort != ''
> > end
> >
> > So, at the end of the loop, sort != '', and the loop terminates.
>
> Ok a 30w light bulb went off so now I see that I've changed the value
> of sort and ended the loop, but, what I don't understand is if the
> loop terminating or cycling is dependent on the user input then the
> initialization of sort should match the gets call. Does my seemingly
> convoluted thinking make sense here ?  If I left sort alone in the
> first 2 lines above, but then assigned another variable =
> gets.....,then I won't know the user wants to quit.
>
> Stuart
>