Continue For Loop in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes how to Continue For loop in Visual Basic .NET.

When you want to start your loop over again you use the Continue For statement which makes the loop jump back to its For statement and increment its looping variable.

This is particularly useful if the program doesn't need to execute the rest of the steps within the body of the loop and wants to start the next iteration quickly.

                        Dim array() As Integer = {1, 3, 5, 7, 10, 20, 50}
                        For i As Integer = 0 To array.GetUpperBound(0)
                            If (array(i) <> 10) Then
                                'Continue the loop 
                                Continue For
                            End If

This will not execute Console.WriteLine(array(i)) when value is not 10 but will be executed when value is 10.

Previous Lesson | Next Lesson

Share This

Home | About | Contact | Privacy Policy

Copyright 2018 - All Rights Reserved.