continue
noun
say it: “kun-TIN-yoo” /kənˈtɪnjuː/
A statement that skips the rest of the current pass of a loop and goes on to the next one.
What does continue do in C#?
continue — A statement that skips the rest of the current loop repetition.
class NumberFinder
{
int FirstOdd(int[] numbers)
{
foreach (int number in numbers)
{
if (number % 2 == 0)
{
continue;
}
return number;
}
return -1;
}
}
In a sentence
- “The loop uses continue to skip books that are out of stock.”
Level: Apprentice · More C# terms at this level
Updated