Dynamic nested For-Loops? (dumb question)

This is going to sound stupid - but I have a weird question. So I’m working on a dynamic programming problem just for fun, nothing novel (been solved 20yrs ago). I’ve always found the dichotomy between recursion and loops very interesting. Sometimes I think we’re missing an operator in Computer Science… Anyways,

In Julia is it possible to dynamically dispatch a series of for-next loops? I can solve the problem I want too pretty straightforwardly with recursion but my experiences with Julia and recursion have been that there’s some performance cost(usually nothing major). I imagine this could be done via a while loop right.

But imagine we needed to track information as we’re going through the loops and things, preserve order of which loop to go to next for performance, etc. The control structure is more linear than maybe recursion but, seems clunky.

Is there a more elegant way to tie this down? Is metaprogramming too far? FoldLeft over for loops? or something crazy like that.

Edit - I also do realize iterators make life a lot easier for these tasks, I’m just trying to get at the fundamentals.