- ©«¤l
- 20
- ¥DÃD
- 18
- ºëµØ
- 0
- ¿n¤À
- 43
- ÂI¦W
- 0
- §@·~¨t²Î
- windows xp
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-9-5
- ³Ì«áµn¿ý
- 2011-9-6
|
VB.NET ±Ð¾Ç 廻°é
'¦¸¼Æ°j°é
02 Module TestForNext
03 Public Sub Main()
04 '©w¸q°Ï°ìÅܼÆ
05 Dim i1 As Int32
06 For i1 = 1 To 9
07 System.Console.WriteLine(i1)
08 '¸õ¥X
09 If (i1 = 5) Then
10 '¸õ¥X³o¤@Ó°j°é
11 Exit For
12 End If
13 'i1¦Û°Ê²Öp1
14 Next
15 System.Console.WriteLine(i1)
16 For i2 As Int32 = 1 To 10 Step 2
17 System.Console.WriteLine(i2)
18 Next
19 'System.Console.WriteLine(i2) i2¥Í©R¶g´Á¨S¦³¨ì³o¸Ì
20 End Sub
21 End Module
±_ª¬¦¸¼Æ廻°é
view sourceprint?01 '±_ª¬°j°é
02 Module TestNestedFor
03 '¥Dµ{¦¡
04 Public Sub Main()
05 '¤W¼h°j°é
06 outer:
07 For i As Int32 = 1 To 9
08 '¤º°é
09 inner:
10 For k As Int32 = 1 To 9
11
12 System.Console.WriteLine(i.ToString() + " X " + k.ToString() + " = " + (i * k).ToString())
13 '§PÂ_
14 If (k = 5) Then
15 Exit For '³Ìªñ¨º¤@¦^°é
16 End If
17 Next
18 Next
19 End Sub
20 End Module
±ø¥ó廻°é
view sourceprint?01 '±ø¥ó¦¡°j°é
02 Module TestWhile
03 Public Sub Main()
04 'µL½aºÉ°j°é
05 Dim i1 As Int32 = 0
06 While (True)
07 i1 += 1 'i1=i1+1
08 System.Console.WriteLine(i1.ToString())
09 '¸õ¥X¥h
10 If (i1 = 100) Then
11 Exit While
12 End If
13 End While
14
15 '¶i¦æ¤ñ¹ï
16 Dim r1 As Int32 = 0
17 While (r1 <= 100)
18 System.Console.WriteLine(r1.ToString())
19 '»¼¼W§@·~
20 r1 += 1
21 End While
22 End Sub
23 End Module
DoWhile
view sourceprint?1 Module TestDoWhile
2 Public Sub Main()
3 '¥ý°õ¦æ«á§PÂ_
4 Dim i1 As Int32 = 100
5 Do
6 System.Console.WriteLine(i1.ToString())
7 Loop While (i1 < 100)
8 End Sub
9 End Module |
|