Thursday, May 14, 2009

Example (a) For Loop

Example (a) For Loop

For counter=1 to 10
display.Text=counter
Next



Example (b)

For counter=1 to 1000 step 10

counter=counter+1

Next



Example (c)

For counter=1000 to 5 step -5

counter=counter-10

Next


*Notice that increment can be negative



Example (d)

Private Sub Form_Activate( )

For n=1 to 10

If n>6 then

Exit For

Else

Print n

End If

End Sub

No comments:

Post a Comment