Limits on Recursion?
-
Does anyone know the limit on recursion for inline functions? Are there exceptions, or can an inline function never (ever) call itself?
Thanks!
-
recursion works. try at your own risk.
I believe it is also dependant on what parameters you pass, for a simple int it should not be that bad but passing down huge objects might cause it to give up sooner since in theory it consumes more memory.
inline function count(currentNumber) { if(currentNumber <= 100) { Console.print("Count: " + currentNumber); count(currentNumber + 1); // Recursive call } } // Start the recursion with 1 count(1);
-
@oskarsh Thank you - that makes sense. This simplifies my code immensely.
I was thinking that a lot of recursion - like a recursive descent parser - would be too much. I know there are some error messages that HISE throws to protect against recursion (which is a good thing), but apparently doing it one layer deep is cool.
-