Procedures that call each others

Hi.
I need to make a procedure (do_A) that calls other procedures (do_B), which is under some conditions may call back the first one (do_A)..
Does AFL allows to do that? How should I "pre_reserve" the name for the second procedure?
Thank you!

procedure do_A(run_D)
	{
	if (run_D)
		{
		do_D;
		}
	else
		{
		do_B();
		}
	}

procedure do_B()
	{
	if (run_C) {do_C}
	else 
		{
		do_D = True;
		do_A(do_D);
		}


https://www.amibroker.com/guide/a_userfunctions.html

Note also that recursion (having a function call itself from within itself) is NOT supported as for now.

Yours is a case of indirect recursion which is a subset of recursion and therefore the above should hold.

If you explain your Goal more clearly, you could get a workaround.

You should have a guaranteed way to get out and not let the code run into infinite loop.

1 Like

Thank you Travick. So I know now that indirect nor direct Recursion is not supported.
I can find the way to work around that my self..

Every recursion can be written as iteration and iteration is pretty much always more efficient in space and CPU terms.

1 Like