pharrington wrote: > On Aug 7, 7:52pm, Mrmaster Mrmaster <mrsolarl... / gmail.com> wrote: >> >> puts target >> -- >> Posted viahttp://www.ruby-forum.com/. > > When coding recursively, you *always* need to test for the exit > condition first. With searches, this means ensuring your result set > isn't empty before continuing. If your code still loops endlessly > after doing this, it helps to print the search set each step of the > way to see exactly whats going wrong. > > (in this case your set is actually the bounds passed to the method, > not the array itself ***) When I use 6 it gave me the answer but when I tried 20 as the target i received that answer. Wouldn't my exist be the either it found or else it didn't? I'm sorry but i don't know what you mean by your statement: >(in this case your set is actually the bounds passed to the method, > not the array itself ***) -- Posted via http://www.ruby-forum.com/.