I got some tips. I describe the tip for labeled for statement.
We can write the for statement with label and the example is following:
for1: for(int i = 0; i < 10; i++) {
for2: for(int j = 0; j < 5; j++) {
int k = getValue(i, j);
if (k == 1)
continue for1;
else if (k == 2)
break for1;
}
}
But the labeled for statement is not allowed in C#. So we need to write it :
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 5; j++) {
int k = getValue(i, j);
if (k == 1)
goto continue_for_for1;
else if (k == 2)
goto break_for_for1;
}
continue_for_for1:
}
break_for_for1:
No comments:
Post a Comment