The continue Statement
“Your experience has been a most entertaining one,” remarked Holmes
as his client paused and refreshed his memory with a huge pinch of snuff.
“Pray continue your very interesting statement.”
A continue statement may occur only in a while, do, or for statement; statements
of these three kinds are called iteration statements. Control passes to the
loop-continuation point of an iteration statement.
ContinueStatement:
continue Identifieropt ;
ends the current iteration and begins a new one.
Program
class Graph
{
public Graph loseEdges(int i, int j)
{
int n = edges.length;
int[][] newedges = new int[n][];
edgelists: for (int k = 0; k < n; ++k)
{
int z;
search:
{
if (k == i)
{
}
else if (k == j)
{
}
newedges[k] = edges[k];
continue edgelists;
}
// search
} // edgelists
return new Graph(newedges);
}
}
Which to use, if either, is largely a matter of programming style.
Buy It Now
“Your experience has been a most entertaining one,” remarked Holmes
as his client paused and refreshed his memory with a huge pinch of snuff.
“Pray continue your very interesting statement.”
A continue statement may occur only in a while, do, or for statement; statements
of these three kinds are called iteration statements. Control passes to the
loop-continuation point of an iteration statement.
ContinueStatement:
continue Identifieropt ;
- A continue statement with no label attempts to transfer control to the innermost
enclosing while, do, or for statement of the immediately enclosing methodor initializer block; this statement, which is called the continue target, then immediately
ends the current iteration and begins a new one.
Program
class Graph
{
public Graph loseEdges(int i, int j)
{
int n = edges.length;
int[][] newedges = new int[n][];
edgelists: for (int k = 0; k < n; ++k)
{
int z;
search:
{
if (k == i)
{
}
else if (k == j)
{
}
newedges[k] = edges[k];
continue edgelists;
}
// search
} // edgelists
return new Graph(newedges);
}
}
Which to use, if either, is largely a matter of programming style.
Buy It Now
0 comments:
Post a Comment