c# - Error inserting code after a break -


it's gives me error after break in second if sequence.

int value; value=somemethod(); foreach(list<gameobject>lista in tilesorganizadosporcoluna) {     bool found=false;        //dosomething();      if(value==1)     {       //if value=1 first iteration.     break;     } }  if(!found) //dootherthhink(); } 

what's correct way it? (i want stop foreach loop not if)thanks. tryed google, example found. (that break inside if stop foreach not if).

the lack of indentation makes hard read, figure meant this:

bool found=false;  int value; value=...;  foreach(list<gameobject>lista in tilesorganizadosporcoluna) {     if(value==1)     {            found=true;         break;      } }  if(!found) {     //dosomething() } 

you missing couple of brackets. figure ide should have warned of this.

i'm afraid code doesn't make whole lot of sense though, since you're not doing you're iterating, found dependant on value initialized to.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

java - Could not locate OpenAL library -

Non Unique Username with ASP.Net Identity 2.0 -