break; instruction
-
Suppose we have that part of code:
for(...) { foreach(...) { if (...) { while(...) { -> XXX <- } } } }
how am I supposed to exit from the place 'XXX' so that I would 'land' outside (after) the most internal ('for') loop?
-
Suppose we have that part of code:
for(...) { foreach(...) { if (...) { while(...) { -> XXX <- } } } }
how am I supposed to exit from the place 'XXX' so that I would 'land' outside (after) the most internal ('for') loop?
Yoyosch wrote: how am I supposed to exit from the place 'XXX' so that I would 'land' outside (after) the most internal ('for') loop? Use
goto
for(...)
{
foreach(...)
{
if (...)
{
while(...)
{
//-> XXX <-
goto Gotcha;
}
}
}
}
Gotcha:
Console.WriteLine("Gotcha");Andres Manggini. Buenos Aires - Argentina.
-
Yoyosch wrote: how am I supposed to exit from the place 'XXX' so that I would 'land' outside (after) the most internal ('for') loop? Use
goto
for(...)
{
foreach(...)
{
if (...)
{
while(...)
{
//-> XXX <-
goto Gotcha;
}
}
}
}
Gotcha:
Console.WriteLine("Gotcha");Andres Manggini. Buenos Aires - Argentina.
-
this is surely fastest way but is recognazed as extremaly nasty... there is no other way (line using several break;`s ?)
You would have to rethink the logical program flow then. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
-
this is surely fastest way but is recognazed as extremaly nasty... there is no other way (line using several break;`s ?)