0% found this document useful (0 votes)
21 views1 page

Looping

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Looping

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Vb.NET Kegalle Technical College.

Looping
This is an important programming technique to repeat some command until the specified
condition is met.

Visual Basic has the following loop structures.

1. For…Next Loop
Format :
For variable_Name = startNumber to endNumber (Step increment)
One or more Visual Basic statements
Next
To exit a For...Next Loop, you can place the Exit For statement within the loop.
2. Do Loop

Format 1.
Do While condition
Block of one or more Visual Basic statements
Loop

Format 2.

Do
Block of one or more Visual Basic statements
Loop While condition

Format 3.

Do Until condition
Block of one or more Visual Basic statements
Loop

Format 4.
Do
Block of one or more Visual Basic statements
Loop Until condition

Exercise:
1. Write code to generate the following number series using the above each formats.
(a) 5 10 15 20 25
(b) 10 7 4 1
2. Write a program to find the sum of all multiples of 6 from 10 to 50.

You might also like