Highly nested loops

I am creating a procedure that does calculations for a problem with a significant number of branches. I have nested for-endfor and if-endif loops to perform the calculations. Everything was working fine as I gradually increased the level of nesting until I went beyond 16 levels. Now my procedure just skips to the end without doing any of the loops or calculations. No error is reported. Is Igor limited in the extent to which loops can be nested?

tdh
I have a 30x30 array with a few valid data points in each row. I need to do a calculation on every possible path from a data point in row 1 to a point in row 2 to row 3 ... And so on. As I increased the depth of nesting it suddenly skips the entire calculation. Maybe a memory issue or maybe a limitation built into Igor to not allow more than 16 deep nested loops?
I was asking for minimal working example.

Here for loops can be nested more than 16 levels. I'm using Igor 7.

#pragma TextEncoding = "Windows-1252"
#pragma rtGlobals=3     // Use modern global access method and strict wave access.
 
Function DoStuff()
    for(;;)
        for(;;)
            for(;;)
                for(;;)
                    for(;;)
                        for(;;)
                            for(;;)
                                for(;;)
                                    for(;;)
                                        for(;;)
                                            for(;;)
                                                for(;;)
                                                    for(;;)
                                                        for(;;)
                                                            for(;;)
                                                                for(;;)
                                                                    for(;;)
                                                                        for(;;)
                                                                            for(;;)
                                                                                for(;;)
                                                                                    for(;;)
                                                                                        for(;;)
                                                                                            print "123"
                                                                                        endfor
                                                                                    endfor
                                                                                endfor
                                                                            endfor
                                                                        endfor
                                                                    endfor
                                                                endfor
                                                            endfor
                                                        endfor
                                                    endfor
                                                endfor
                                            endfor
                                        endfor
                                    endfor
                                endfor
                            endfor
                        endfor
                    endfor
                endfor
            endfor
        endfor
    endfor
End
tdhammond wrote:
I have a 30x30 array with a few valid data points in each row. I need to do a calculation on every possible path from a data point in row 1 to a point in row 2 to row 3 ... And so on. As I increased the depth of nesting it suddenly skips the entire calculation. Maybe a memory issue or maybe a limitation built into Igor to not allow more than 16 deep nested loops?


It would be good to look at the code in question. Are you trying to minimize some path integral?