Is there a VB equivalent to C#'s 'continue' and 'break' statements?

Jude Allred picture Jude Allred · Sep 10, 2009 · Viewed 8.6k times · Source

For sake of argument, how could I do this in VB?

foreach foo in bar
{
   if (foo == null)
       break;

   if (foo = "sample")
       continue;

   // More code
   //...
}

Answer

Noon Silk picture Noon Silk · Sep 10, 2009

-- Edit:

You've changed your question since I've answered, but I'll leave my answer here; I suspect a VB.NET programmer will show you how to implement such a loop. I don't want to hurt my poor C# compilers feelings by trying...

-- Old response:

I believe there is

Continue While
Continue For

and

Exit While
Exit For