In this tutorial, we cover the third and last loop, the Do Until loop. All of the loops are similar, but the Do until loop will execute a piece of code until a condition is true. When condition is true enter in the and execute the code in do until loop block.
Code
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num As Integer = 1
Do Until num = 5
MessageBox.Show("The value of num is: " & num)
num = num + 1
Loop
End Sub
End Class
No comments:
Post a Comment