|
From: | fork |
Subject: | Re: Simple (and probably stupid) question about for loops |
Date: | Tue, 25 May 2010 15:12:04 +0000 (UTC) |
User-agent: | Loom/3.14 (http://gmane.org/) |
> | Here it is my question : is it possible to update the value of the for index > | inside the loop? > > It's not a different variable. The value is reset each time at the > top of the loop. As a general practice, I would avoid EVER assigning to an index variable ("k") inside a loop, because it is just too hard to understand. Here you could append to a vector based on an if statement using k (if k > 3 out(end) = k endif).
[Prev in Thread] | Current Thread | [Next in Thread] |