top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What happens when you encounter a continue statement inside the for loop?

+1 vote
339 views
What happens when you encounter a continue statement inside the for loop?
posted Feb 12, 2015 by Saravanan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

When encountering the "continue" statement, processing of current iteration is stopped, starts executing the next iteration in the for loop (after changing the loop index).

answer Feb 12, 2015 by R.senthil
Similar Questions
+3 votes

In what order should a open/fetch/loop set of commands in a PL/SQL block be implemented if you use the %NOTFOUND cursor variable in the exit when statement? Why?

+1 vote

What is the overhead in splitting a for-loop like this,

int i;
for (i = 0; i < exchanges; i++)
{
    // some code
    // some more code
    // even more code
}

into multiple for-loops like this?

int i;
for (i = 0; i < exchanges; i++)
{
    // some code
}
for (i = 0; i < exchanges; i++)
{
    // some more code
}
for (i = 0; i < exchanges; i++)
{
    // even more code
}

The code is performance-sensitive, but doing the latter would improve readability significantly. (In case it matters, there are no other loops, variable declarations, or function calls, save for a few accessors, within each loop.)

I'm not exactly a low-level programming guru, so it'd be even better if someone could measure up the performance hit in comparison to basic operations, e.g. "Each additional for-loop would cost the equivalent of two int allocations." But, I understand (and wouldn't be surprised) if it's not that simple.

...