Logo

Programming-Idioms

History of Idiom 78 > diff from v58 to v59

Edit summary for version 59 by DRodge:
[VB] Simplified to be more in line with requested format

Version 58

2017-06-06, 13:42:26

Version 59

2017-06-06, 13:49:00

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

Extra Keywords
until
Extra Keywords
until
Code
Sub someThing() 
Dim loop_ctr As Integer  
loop_ctr = 100  
Do  
 MsgBox "Loop Counter : " & loop_ctr  
 loop_ctr = loop_ctr + 1  
 Loop While loop_ctr < 10  
End Sub 
Code
Sub someThing() 
Do 
   [someThing()  1]
   [someThing()  2]
   ...
   [someThing()  n]
   [Exit Do]
   [someThing()  1]
   [someThing()  2]
   ...
   [someThing()  n]
Loop While condition
End Sub 
Origin
http://www.exceltrick.com/formulas_macros/vba-loops-for-while-until-loops/
Origin
http://www.tutorialspoint.com/vba/vba_do_while_loop.htm