Do while is very similar to for loop however this generally is used if our loop repetitions is unknown.
Do While:
'Continues until i is greater than 10
Do While i <= 10
i = i + 1
Loop
'Or we can write it so the first loop always executes unconditionally:
'Ends after our first loop as we failed this condition on our previous loop
Do
i = i + 1
Loop While i <= 10
Do Until:
'Ends once i equates to 10
Do Until i = 10
i = i + 1
Loop
'Or we can write it so the first loop always executes unconditionally:
'Ends after our first loop as we failed this condition on our previous loop
Do
i = i + 1
Loop Until i=10
Exiting a Do loop is similar to a for loop but just using the Exit Do statement.
'Exits after i equates to 10
Do Until i = 10
i = i + 1
If i = 7 Then Exit Do
Loop