Hello, there is compact way to skip a for loop when the requested number of iterations is 0 ? For example, something equivalent to the following code: for (i in some_function(from=1,to=iteration_cycles)) { ... } Where the loop is skipped when iteration_cycles==0 Thanks in advance. F: Pollastri
On 11/02/2010 9:28 AM, Fabrizio Pollastri wrote:> Hello, > > there is compact way to skip a for loop when the requested number of > iterations is 0 ? > > For example, something equivalent to the following code: > > for (i in some_function(from=1,to=iteration_cycles)) { ... } > > Where the loop is skipped when iteration_cycles==0Sure: for (i in seq_len(iteration_cycles)) { ... } will execute 0 times if requested. Duncan Murdoch