www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - continue in static foreach

reply Marc <jckj33 gmail.com> writes:
How do I use?

 static foreach(enum string member; members) {
 			static if(isFunction!(__traits(getMember, C, m ember))) {
 				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?
Jan 12
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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
Jan 12
parent reply Marc <jckj33 gmail.com> writes:
On Friday, 12 January 2018 at 22:03:53 UTC, H. S. Teoh wrote:
 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
thanks
Jan 12
parent Seb <seb wilzba.ch> writes:
On Saturday, 13 January 2018 at 01:07:24 UTC, Marc wrote:
 On Friday, 12 January 2018 at 22:03:53 UTC, H. S. Teoh wrote:
 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
thanks
It was mentioned in DIP1010, but that bit hasn't been accepted yet: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1010.md#static-break-and-static-continue
Jan 12