A loop is a repetitive execution of a set of statements until some conditions are met.
Do I = 1 To 10
Say "Value of I :" I
End
LEAVE verb leaves the immediate loop after execution.
LEAVE verb leaves the immediate loop after execution.
Do I = 1 To 10
If I = 5 then LEAVE
Say "Value of I :" I
End
Result would be:
Value of I : 1
Value of I : 2
Value of I : 3
Value of I : 4
ITERATE verb ignores the statement following it and starts the next iteration in the loop
Do I = 1 To 10
If I = 5 then ITERATE
Say "Value of I :" I
End
Result would be:
Value of I : 1
Value of I : 2
Value of I : 3
Value of I : 4
Value of I : 6
.
.
.
Value of I : 10
No comments:
Post a Comment