On Friday, 6 February 2015 at 09:43:59 UTC, Rikki Cattermole wrote:
On 6/02/2015 10:37 p.m., Vasileios Anagnostopoulos via Digitalmars-d-learn wrote:

hi,

I observed in the documentation

"If continue is followed by /Identifier/, the /Identifier/ must be the label of an enclosing while, for, or do loop, and the next iteration of that loop is executed. It is an error if there is no such statement."

But there is no example. Can someone provide one example?

I think break also needs a similar example.


void main() {
        import std.stdio : writeln;

        F1: foreach(int i; 0 .. 100) {
                F2: foreach(int j; 0 .. 100) {
                        if (j + i > 5)
                                continue F1;
                        
                        writeln("i: ", i, " j: ", j);
                }
        }
}

Example compiled + running with output:
http://dpaste.dzfl.pl/75291aecb07d

Would you mind putting in a PR to put some examples into the docs?

https://github.com/D-Programming-Language/dlang.org/edit/master/statement.dd

Reply via email to