VB编程:DoWhile...Loop当循环计算0~100累加和
一、运行效果
二、技巧总结
1、常用的循环有三种:
(1)for循环(For...Next);
(2)当循环(Do...While...Loop)或者(While...Wend);
(3)直到循环(Do...Until...Loop);
三、测试代码
Private Sub Command1_Click()
Dim a As Long, b As Long
a = 0
b = 0
Do While a < 100
a = a + 1
b = b + a
Loop
Label1.Caption = "0~100的累加结果为:" & b
End Sub