Do Until…Loop in Visual Basic .NET
Last Updated: March 20, 2022
This loop will run until certain condition meets
We will try to print numbers from 1 to 10 using Do Until ... Loop
Dim count As Integer = 0 Do Until count = 10 Console.WriteLine("Count is now " + count.ToString()) count = count + 1 Loop
Output
Count is now 0
Count is now 1
Count is now 2
Count is now 3
Count is now 4
Count is now 5
Count is now 6
Count is now 7
Count is now 8
Count is now 9
This loop is run until the count is equal to 10. When the count is equal to ten it will quite the loop
Inside the loop you have to use count = count + 1 for incrementing the count variable
Do Until … Loop iterate until the given condition is true