On 6/22/20 3:53 PM, mw wrote:
Hi,
I need this logic:
```
auto range = File(fn).byLine();
foreach (line; range) {
if (comeCond(line)) {
// skip the next n line
// and continue the foreach loop from the (n+1) line
} else {
regularProcess(line);
}
}
```
Is it possible to do this in a foreach loop?
I wouldn't recommend it, instead do a while loop:
auto range = File(fn).byLine;
while(!range.empty)
{
auto line = range.front;
if(someCond(line)) {
range.popFrontN(n);
} else {
regularProcess(line);
range.popFront;
}
}
-Steve