digitalmars.D.learn - Clarification in continue statement
- Vasileios Anagnostopoulos via Digitalmars-d-learn (14/14) Feb 06 2015 hi,
- Rikki Cattermole (15/31) Feb 06 2015 void main() {
- Infiltrator (4/35) Feb 06 2015 Would you mind putting in a PR to put some examples into the docs?
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. -- Dr. Vasileios Anagnostopoulos (MSc,PhD) Researcher/Developer ICCS/NTUA 9 Heroon Polytechneiou Str., Zografou 15773 Athens,Greece T (+30) 2107723404 M (+30) 6936935388 E vanag mail.ntua.gr<mailto:vanag mail.ntua.gr> www.ntua.gr< http://www.ntua.gr/>
Feb 06 2015
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. -- Dr. Vasileios Anagnostopoulos (MSc,PhD) Researcher/Developer ICCS/NTUA 9 Heroon Polytechneiou Str., Zografou 15773 Athens,Greece T (+30) 2107723404 M (+30) 6936935388 E vanag mail.ntua.gr <mailto:vanag mail.ntua.gr><mailto:vanag mail.ntua.gr <mailto:vanag mail.ntua.gr>> www.ntua.gr <http://www.ntua.gr><http://www.ntua.gr/>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
Feb 06 2015
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: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.ddhi, 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
Feb 06 2015