recursion

BlitzPlus Forums/BlitzPlus Beginners Area/recursion

In short: recursion is a function calling itself. To prevent infinite loops there's usually a check built-in.

A small 'n simple example:
rec 10
Notify "done"
End

Function rec(a,counter=0)
	If counter>8 Return ; the check
	
	counter=counter+1
	
	a=a*2 ; the actual functionality of this function
	
	DebugLog "counter   = "+counter+", 'a' value = "+a
	DebugLog "---------------"
	
	rec a,counter ; and call it again.
End Function