Do-While

This will execute code while 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
	'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 While intLoop <= intNumber

intLoop = 1
Do While intLoop <= intNumber
	'as a pre-test
	'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