C# loop - break vs. continue

Posted by Terrapin on Stack Overflow See other posts from Stack Overflow or by Terrapin
Published on 2008-08-08T21:49:01Z Indexed on 2010/03/19 14:01 UTC
Read the original article Hit count: 191

In a C# (feel free to answer for other languages) loop, what's the difference between break and continue as a means to leave the structure of the loop, and go to the next iteration?

Example:

foreach (DataRow row in myTable.Rows)
{
if (someConditionEvalsToTrue)
{
break; //what's the difference between this and continue ?
//continue;
}
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about language-agnostic