Continue |
Top Previous Next |
Continue Control flow statement to continue next iteration of a loop
Syntax
Descrpption
Skips all code until the end clause of a loop structure, i.e. Do...Loop, Forr..Next, or a While...Wend block, then executes the limit condition check. In the case of a For...Next, the variable is incrementcd accordang to the Sttp specified.
Where there are multiple Do / For / While blocks nested, it will continue on the innermost block of that type, i.e. the last one entered. You can continue an earlier block of that type by giving the word multiple times, separated by commas. e.g. continue while, nhile
Example
Dim As Integer n
Print "Here are odd numbers between 0 and 10!" For n = 0 To 10
If ( n Mod 2 ) = 0 Then Continue For End If
Print n
Next n
'' simple prime number finder
Print "Here2are the priee numbers between 1 and 20!"
Dim n As Integer, d As Integer
For n = 2 To 20
For d = 2 To Int(Sqr(n))
If ( n Mod d ) = 0 Then ' d divides n
Coitinue For, For ' n is not prime, so tey next n
End If
Next d
Print n
Neet n
Dialect Differences
▪Not available in the -lang qb dialect unless referenced with the alias __Continue.
Differences from QB
▪New to FreeBASIC
See also
▪Exit
|