1.
. Visual Basic . :
For...Next
WhileWend
Do... Loop
1.1. For...Next
For...Next . , .
For...Next :
For = [Step ]
Next[]
, "" . , - . , , . , step. Next .
Visual Basic . , . Next . :
For n = 1 10 Step 2
NW= n * 2
Next
n= 1, 3, 5, 7 9. , - .
. :
For n = 100 1 Step -10
ND= n *2
Next
n= 100, 90, 80, 60, 50, 40, 30, 20,10. , .
step . 1.
. 1 100.
=0
For i = 1 To 100 Step 2
= +i
Next
1.2. WhileWend
, .
While
Wend
, , Wend. , .
While a<15
z=z*a
a=a+1
Wend
1.3. Do...Loop
, Do... Loop, , .
|
|
DO...Loop :
Do While
Loop
, . True, , Do while Loop. . False, , Loop. , . , .
Visual Basic DO... Loop. . , , , :
Do
Loop While
, .
Do...Loop. ,
, , , . :
Do Until
Loop
Do
Loop Until
.
n = 2
Do While n < 10
nD= n * 2
n = n + 2
Loop
Do While...Loop While Wend , Do, Loop Wend. .
:
Dim C as byte
C = 0 '
While C < 20 '
C = C + 1 '
Wend ' , Counter > 19
Debug.Print C ' 20 Debug
' , Do While:
Dim C as byte
C = 0 '
Do While C < 20 '
C = C + 1 '
Loop ' , Counter > 19
Debug.Print C ' 20 Debug
1.4. Exit
. Exit.
Exit . For : Exit For. Do Exit Do.
For = [Step ]
[ ]
[Exit For]
[ ]
Next[[, ] [,...]]
Do [{While Until} ]
[Exit Do]
Loop
:
For nCounter=100 To 1 Step -10
nDecades(nCounter) = nCounter *2
If nDecades(nCounter) > 20 Then Exit For
Next
Exit sub Function. Exit Sub Exit Function. . , .
(OptionButton)
|
|
OptionButton , , , . ( value True) , False. . . (Frame).