foreach loop

Dominikus Dittes Scherkl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 19 07:35:55 PDT 2015


On Monday, 19 October 2015 at 14:28:06 UTC, 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;
> }

Of course. D uses even the same keyword for this as C does: break.


More information about the Digitalmars-d-learn mailing list