R
Richard A. DeVenezia
Can a function write another function that has a specific number of
nested loops and then run it?
i.e.
function maker (N) {
// does stuff that creates function doer()
// invoke doer
doer()
}
For a specific value of N, doer might have this construction:
function doer() {
for (i0=0;i0<x;i0++ {
for (i1=0;i1<x;i1++ {
...
for (i#N#=0;i#N#<x;i#N#++ {
// stuff
}...}} // N closing braces
}
i#N# simply means replace #N# with what ever value of N is.
So for N=4, I would want 4 nested loops, for N=5 I would want 5 nested
loops, etc...
Thanks,
Richard
nested loops and then run it?
i.e.
function maker (N) {
// does stuff that creates function doer()
// invoke doer
doer()
}
For a specific value of N, doer might have this construction:
function doer() {
for (i0=0;i0<x;i0++ {
for (i1=0;i1<x;i1++ {
...
for (i#N#=0;i#N#<x;i#N#++ {
// stuff
}...}} // N closing braces
}
i#N# simply means replace #N# with what ever value of N is.
So for N=4, I would want 4 nested loops, for N=5 I would want 5 nested
loops, etc...
Thanks,
Richard