Re: Trouble Writing My Own Sort Method

That would mean either unsorted[0] or unsorted[a] is nil. This means there is no value. My first guess without actually running it is that you are getting to the end, where you've popped everything off of unsorted, and unsorted[0] has no value.