欢迎你访问我的个人网站:www.6ideas.cn,资料更丰富.

VB 中的循環(FOR,While,Do..Loop)

Posted on 2007-04-09 10:13  talantlee  阅读(2779)  评论(0)    收藏  举报
1>For index=start to end[Step step]
   [statements]
   [Exit For]
   [statements]
   Next[index]

example:
For d = 0 To 2
System.Console.WriteLine("In the For Loop")
Next d

2>While condition
   [statements]
   wend

example
Dim d, e As Integer
d = 0
e = 6
While e > 4
e -= 1
d += 1
End While
3>Do[{while | Until} condition]
   [statements]
   [Exit Do]
   [statements]
   Loop

example:
Do Until str = "Cool"
System.Console.WriteLine("What to do?")
str = System.Console.ReadLine()
Loop

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3