From: James Coglan Date: 2009-07-21T17:58:03+09:00 Subject: Re: create a variable number of loop --001636c5bd8c9490d2046f3373b8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 2009/7/21 Li Chen > Hi all, > > I want to create a variable number of loop based on the input: > if the input is 1, I will create a loop ( I call it 1-loop); > if the input is 2 , I will create a nested loop( 2-loop); > if the input is 3, I will create a loop of loop of loop (3-loop); > if the input is 4, I will create a 4-loop, so on and so on. > How I can do that? Would this input be the size of the array you're looping over? Seems from your example that you're trying to sum all the combinations of values in the array. If so there's probably a clean recursive way to do this. -- James Coglan http://jcoglan.com --001636c5bd8c9490d2046f3373b8--