Thread: Abort recursion
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike NG Mike NG is offline
external usenet poster
 
Posts: 87
Default Abort recursion

If I have a procedure which I call recursively. Is there a way I can say
exit all the way out completely. I know I could put logic and pass
flags up through the parameters etc. but just wondered if I could do
this another way

e.g a simple example

Sub Main ()
Hello (1)
End Sub

Sub Hello (x as Integer)
MsgBox x

if x < 10 then
Hello(x+1)
else
<some more processing
end if
end sub

It's a bit hard to explain cos the above is simple and what I am trying
to do is more complicated, but when the recursion reaches the end, I'd
like all the levels of Hello to unravel with no more execution taking
place
--
Mike