VB编程:While...Wend语句实例漂亮的星星
运行效果:
程序代码:
Private Sub Command1_Click()
Dim a As Long, b As Long
Form1.Cls '清空窗体
While a <= 9 '限制条件,0-9,一共输出10行
a = a + 1 '调整输出位置
For b = 1 To 23 - a
Print " ";
Next b
For b = 1 To 2 * a - 1
Print "*";
Next b
Print
Wend
End Sub
编写总结:
1、print后面的“;”表示不换行连续输出;
2、单独输出print,表示回车换行;
3、VB编程时,敲入“?”会自动变为print。