foreach loop
Rikki Cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 19 07:43:03 PDT 2015
On 20/10/15 3:28 AM, Namal wrote:
> Is it possible to create a foreach loop with a breakstetemen?
>
> I mean something like that for the second loop where i want to break if
> element from:
>
> int [] g = [9,15,21];
> int [] v = [2,3,5,7,8,9,11,13,17,19];
>
> foreach(j;1..10)
> for(int i = 0; v[i]<j;++i){
> do something;
> }
If you want to break a specific loop, use labels.
L1:
foreach(i; 0 .. 10) {
L2: foreach(j; 0 .. 10) {
// break L1;
// break L2;
// or
// break;
}
}
More information about the Digitalmars-d-learn
mailing list