(07-02-2024, 08:05 PM)Pete Wrote: I avoid making recursive calls within a sub to avoid stack space issues. Those were a big deal in QB, but not so much in QB64. I would assign a variable, exit the sub, and the next statement would determine to either re-loop the subroutine or move on.
Code: (Select All)DO
MySub x
IF x = 1 THEN EXIT DO
LOOP
Mysub
a = INT(RND * 20)
IF a = 5 THEN x = 1
END SUB
Pete
ah took me a moment to figure what was recursive, oh the QuickSort.
That one has been dependable for years, unless miss-coded there is no danger of a runaway stack space blowing out memory, it needs less and less space on each call. on average it divides in half each time and from math we know the limit of the sum of halfing is 2, or twice the array size.
Ha just made that up, sounds pretty good right? it may be actually correct
Zenos Tortoise and Hare Paradox is not.
b = b + ...