" I am trying to use this code: entLoop:for(var i:*in entities) { for(var i2:*in ignoreEntities) { if(entities[i...">

Cannot use "continue <label>"

I am trying to use this code:

entLoop:for(var i:*in entities) {
    for(var i2:*in ignoreEntities) {
        if(entities[i].type==ignoreEntities[i2]) {
            continue entLoop;
        }
    }
}

Why doesn't it work? Error:

The target continue statement was not found.

+3
source share
2 answers

I may be wrong, but it seems that the command continuedoes not work with loops for...in.

The compiler does not cause errors 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 with true, since I have no definitions for arrays entitiesand ignoreEntities)

+2
source
-2

Source: https://habr.com/ru/post/1737581/


All Articles