Monday, 9 October 2017

Loops

Loops
VB.Net provides following types of loops to handle looping requirements. 

Loop Type
Description
Do Loop
It repeats the enclosed block of statements while a Boolean condition is True or until the condition becomes True. It could be terminated at any time with the Exit Do statement.
For...Next
It repeats a group of statements a specified number of times and a loop index counts the number of loop iterations as the loop executes.
For Each...Next
It repeats a group of statements for each element in a collection. This loop is used for accessing and manipulating all elements in an array or a VB.Net collection.
While... End While
It executes a series of statements as long as a given condition is True.
With... End With
It is not exactly a looping construct. It executes a series of statements that repeatedly refer to a single object or structure.
Nested loops
You can use one or more loops inside any another While, For or Do loop.

0 comments

Post a Comment