开发者

Can't use "continue <label>"

开发者 https://www.devze.com 2022-12-23 03:49 出处:网络
I am trying this code: entLoop:for(var i:*in en开发者_JAVA技巧tities) { for(var i2:*in ignoreEntities) {

I am trying this code:

entLoop:for(var i:*in en开发者_JAVA技巧tities) {
    for(var i2:*in ignoreEntities) {
        if(entities[i].type==ignoreEntities[i2]) {
            continue entLoop;
        }
    }
}

Why is it not working? The error is:

Target of continue statement was not found.


I may be wrong, but it seems that the continue instruction doesn't work with for...in loops.

Compiler doesn't throw any error with this code :

entLoop:for(var i:Number = 0 ; i < 2 ; i++) {
  for(var i2:Number = 0 ; i2 < 2 ; i2++) {
    if(true) {
      continue entLoop;
    }
  }
}

(I replaced your condition by true since I don't have the definitions for your entities and ignoreEntities arrays)


I think you have to use break LABEL; instead.

From live docs : http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/statements.html

0

精彩评论

暂无评论...
验证码 换一张
取 消