continue in static foreach

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Jan 12 22:03:53 UTC 2018


On Fri, Jan 12, 2018 at 10:03:40PM +0000, Marc via Digitalmars-d-learn wrote:
> How do I use?
> 
> > static foreach(enum string member; members) {
> > 			static if(isFunction!(__traits(getMember, C, member))) {
> > 				continue;
> > 			}
> 
> give error:
> 
> > must use labeled continue within static foreach
> 
> then I tried:
> 
> > outer:static foreach(enum string member; members) {
> > 			static if(isFunction!(__traits(getMember, C, member))) {
> > 				continue outer;
> > 			}
> 
> give error:
> 
> > Error: enclosing label outer for continue not found
> 
> How do I fix it?

Unfortunately, this is currently not supported. You'll have to use an
else-clause to handle the case when the condition is false.


T

-- 
Why waste time reinventing the wheel, when you could be reinventing the engine? -- Damian Conway


More information about the Digitalmars-d-learn mailing list