From: Tim Pollard Date: 2010-01-23T04:45:30+09:00 Subject: Re: Sorting Method Hi again, Both of you were quite helpful in your explanations, and I think I understand parameters and recursion a bit better now. I guess the current hangup for me is trying to make these parameters applicable to my sorting method. Also, I decided to try not to use global variables, as I read that they are bad practice...but then I run into the problem of not being able to call my arrays in my method. Here is the code again: def recursive_sort input = [''] unsorted_array = [] sorted_array = [] while not input.empty? input = gets.chomp unsorted_array.push input end if unsorted_array[0] < unsorted_array[1] sorted_array.push && unsorted_array.shift else unsorted_array.push (unsorted_array[1]) && unsorted_array.shift end puts sorted_array end recursive_sort So I guess now my question is twofold: how do I include my initial array assignments and the input = gets.chomp method without them looping? I think I am starting to understand how to get the recursive method as a WHOLE to stop, but I do not want the user to be able to input more words every time the method calls itself, either. That is why I was using global variables in the first place, but I suppose there has to be a way to do it without... Finally, using parameters to call the method: My initial problem was, I suppose, that I expected parameters to be neatly defined. Using the factorial example, method_factorial (n) just didn't make sense to me because I thought that n would have to be a static number (rather than whatever is written after method_factorial). So, I think that sheds some light on my wrapper question too--by having a wrapper it would allow me to call the recursive method with only one parameter instead of two, correct? I just don't understand what my program is supposed to do it I arbitrarily write, say: recursive_sort 418, 958 The parameters should be the arrays to be sorted, correct? I guess I'm just not fully wrapping my head around the problem, and this message is probably confusing, so I apologize. Just trying to understand it fully. I think it is coming slowly, but I don't know why I'm having such a difficult time with this. Thanks for your initial responses, Robert and Jesús. Regards, Timothy