vb.net基础 迭代For循环Do循环
VS2019 x86vb.net基础Public Class Form1Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim iCount As Integer
For iCount = 0 To 30 Step 5
'Beep()
'Threading.Thread.Sleep(3000)
MsgBox("Sum " & iCount)
Next
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim iCount As Integer
Dim stOut As String
For iCount = 30 To 0 Step -5
stOut = stOut & iCount & vbNewLine
Next
MsgBox(stOut)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim x As Integer
x = 0
Do While x < 5
x += 1
MsgBox("Sum " & x)
Loop
x = 0
Do Until x = 5
x += 1
MsgBox("Sum " & x)
Loop
x = 0
Do
x += 1
MsgBox("Sum " & x)
Loop Until x = 5
x = 0
Do
x += 1
MsgBox("Sum " & x)
Loop While x < 5
End Sub
End Class
页:
[1]