2

let's say I have a foreach loop to perform some processing on List MyTypeInstanveVariable

foreach(MyType item in MyTypeInstanceVariable) {
    if (cond1) {}

    if (cond2) {}
}

If cond1 is met I want to advance to the next item in the MyTypeInstanceVariable. Now I could add a little boolean to check whether to evaluate cond2, but is there some built in command that will quickly move onto the next item? I can't use break as that would break out of the foreach loop altogether

Thanks Thomas

1

2 Answers 2

8

You are looking for the continue statement.

Sign up to request clarification or add additional context in comments.

1 Comment

we've all been there before ;-)
2

perhaps continue?

http://msdn.microsoft.com/en-us/library/923ahwt1(v=vs.71).aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.