|
-
Sep 2nd, 2000, 05:46 AM
#1
Thread Starter
Hyperactive Member
Whats the difference between these?
Code:
(1)
While a > 1
...
Wend
(2)
Do While a > 1
...
Loop
WP
-
Sep 2nd, 2000, 05:54 AM
#2
None!
The Do loop can be written like this:
Code:
Do While a > 1
'...
Loop
'or like this
Do Until a > 1
'...
Loop
'or you can put the While|Until part at the end
Do
'...
Loop While a > 1
Do
'...
Loop Until a > 1
But using the first Do loop is the same as doing the While ... WEnd loop.
The reason for having two syntaxes that do the same thing is because the older While ... WEnd loop is an inheritance from older BASIC versions like QBasic.
-
Sep 2nd, 2000, 06:48 AM
#3
Fanatic Member
The guy who wrote a VB Book I've got says that you should always use Do...Loop because it is more flexible.
-
Sep 2nd, 2000, 06:55 AM
#4
Fanatic Member
The Do..Loop iteration type gives you more possibilities to the wanted loop.
The While statement is yes indeed an inheritance of older BASIC versions.
Please note that pseudo-code also uses Do..Loop to explain an iteration process instead of the While notation, because of it's readibility.
-
Sep 2nd, 2000, 07:28 AM
#5
Do...Loop is more flexible than Wend. For example, you can replace While with Until and you have the ability to exit the loop by using a simple Exit Do statement.
-
Sep 2nd, 2000, 07:57 AM
#6
Thread Starter
Hyperactive Member
Thanks
Thanks all of you a lot
WP
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|