Why am I getting an undefined label error in following code?
(I am leaving out some irrelevant code …)
loopLabel:
for(i=0;;i++)
{
{ // some code;
}
{ // some code;
}
}
if(condition)
{
if(condition)
{ // some code
}
else
{
//some code;
continue loopLabel;
}
}
continueis used to skip to the start of a new iteration of a loop; you use a label if you have nested loops and you want to specify which one to jump to. You’re trying to use it like agototo jump to a totally unrelated section of code, which isn’t allowedLegal usage is something like:
(Java guide on branching statements)