Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,125 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,998 people online right now. Registration is fast and FREE... Join Now!




Loops: Equivalents

 
Reply to this topicStart new topic

> Loops: Equivalents, The same thing, different methods

AdamSpeight2008
Group Icon



post 3 Jul, 2008 - 12:44 PM
Post #1


Equivalent Loops

All the following pieces of code do the some thing Loop through a section of code 5 (Five) times.

For .... Next
VB

For i as integer=1 To 5
' < Looping section of code >
Next i


Do ... Loop Until
VB

Dim i as integer=1
do
' < Looping section of code >
i = i + 1
Loop Until i>5


Do ... Loop Until (Method 2)
VB

Dim i as integer=0
do
i = i + 1
' < Looping section of code >
Loop Until i=5


Do ... Loop While
CODE

Dim i as integer=1
do
' < Looping section of code >
i = i + 1
loop while i<=5


Do ... Loop While (Method 2)
CODE

Dim i as integer=0
do
i = i + 1
' < Looping section of code >
loop while i<5


While ... End While
CODE

Dim i as integer=0
While i<5
i = i + 1
' < Loop section of code >
End while


While ... End While (Method 2)
CODE

Dim i as integer=1
While i<=5
' < Loop section of code >
i = i + 1
End while


I hope you find these examples useful in developing your programming skills.
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

captainhampton
Group Icon



post 11 Jul, 2008 - 11:20 AM
Post #2
I've never really gotten in VB, but I've been wanting to add it to my palette of programming for a while now, and because of this tutorial I just may! Good show!
Go to the top of the page
+Quote Post


Fast ReplyReply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 11/21/08 11:17AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month