You are on page 1of 2

''''''''''''''''''vb scripting loops''''''''''''

'(1) while
Dim i,a,b,c
i=1
While i<=10
print i
i=i+1
Wend
'(2) do[while/util condition]
'------------------------------'do while
a=1
Do while a<=10
print a
a=a+1
Loop
''exit do
''--------b=1
Do while b<=100
print b
b=b+1
If b=5 Then
Exit do
End If
Loop
''do untili
c=1
Do until c=10
print c
c=c+1
Loop

' (3) for loop


'---------------For i=1 to 10 step 1
print i
Next
''''''or''''''''''''''''
For i=1 to 10 step 2
print i
Next
For i=1 to 100 step 1
print i
If i=5 Then
Exit for
End If
Next

'(4) for each loop


'---------------------Dim x(2)
x(0)=10
x(1)=20
x(2)=30
For each element in x
print element
Next

You might also like