Sub Main()
'This first example uses the Do...While statement, which performs
'the iteration, then checks the condition, and repeats if the
'condition is True.
Dim a$(100)
i% = -1
Do
i% = i% + 1
If i% = 0 Then
a(i%) = Dir("*")
Else
a(i%) = Dir
End If
Loop While(a(i%) <> "" And i% <= 99)
r% = SelectBox(i% & " files found",,a)
End Sub
Sub Main()
'This second example uses the Do While...Loop, which checks the
'condition and then repeats if the condition is True.
Dim a$(100)
i% = 0
a(i%) = Dir("*")
Do While (a(i%) <> "") And (i% <= 99)
i% = i% + 1
a(i%) = Dir
Loop
r% = SelectBox(i% & " files found",,a)
End Sub
Sub Main()
'This third example uses the Do Until...Loop, which does the
'iteration and then checks the condition and repeats if the
'condition is True.
Dim a$(100)
i% = 0
a(i%) = Dir("*")
Do Until (a(i%) = "") Or (i% = 100)
i% = i% + 1
a(i%) = Dir
Loop
r% = SelectBox(i% & " files found",,a)
End Sub
Sub Main()
'This last example uses the Do...Until Loop, which performs the
'iteration first, checks the condition, and repeats if the
'condition is True.
Dim a$(100)
i% = -1
Do
i% = i% + 1
If i% = 0 Then
a(i%) = Dir("*")
Else
a(i%) = Dir
End If
Loop Until (a(i%) = "") Or (i% = 100)
r% = SelectBox(i% & " files found",,a)
End Sub
|