New Feature in VB.NET 2005 – The Continue Statement,Next iteration

If i feel this will help others i posted. 

The Continue statement skips the remaining statements in the loop body of a repetition statement and causes control to proceed to the next iteration of the loop.

Code example for Visual Studio 2005 May 2004 Community Preview

‘ // Continue Statement in Visual Basic 8.0

‘ For using Continue statement.

For i As Integer = 0 To 100

     ‘ If i = 50 skip Console.Writeline statement

     If i = 50 Then Continue For

     Console.WriteLine(i.ToString)

Next

 

‘ Do While using Continue statement.

Dim ii As Integer = 1Do While ii < 100

     ii += 1

     ‘ If i = 50 skip Console.Writeline statement

     If ii = 50 Then Continue Do

     Console.WriteLine(ii.ToString)

Loop

 

‘ While using Continue statement.

Dim iii As Integer = 1While iii < 100

     iii += 1

     ‘ If i = 50 skip Console.Writeline statement

     If iii = 50 Then Continue While

     Console.WriteLine(iii.ToString)

End While

for more details:

http://blogs.vbcity.com/mcintyre/archive/2004/08/03/151.aspx

http://safari.oreilly.com/013225140X/ch06lev1sec9

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s