Do-Until

This will execute code until the condition is true.

Identify the three basic parts in the loops below:

  1. initialize
  2. test
  3. increment/decrement
Dim intLoop as Integer
Dim intTriangle as Integer
Dim intFactorial as Integer

intLoop = 1
Do
	'as a post-test loop
	'this loop will calculate the triangle value of a number
	' and the factorial value of a number
	intTriangle = intTriangle + intLoop
	intFactorial =intFactorial * intLoop
	intLoop = intLoop + 1
Loop Until intLoop > intNumber

intLoop = 1
Do Until intLoop > intNumber
	'as a pre-test loop
	'this loop will calculate the triangle value of a number
	' and the factorial value of a number
	intTriangle = intTriangle + intLoop
	intFactorial =intFactorial * intLoop
	intLoop = intLoop + 1
Loop