The Step By Step Program

This program shows you the use of the For-next command, which has been modified by the Step command.

You just need an empty form to get it going.

The Code:

    PUBLIC SUB Form_Open()
    DIM x AS Integer
    FOR x = 0 TO 100 STEP 5
    PRINT x,
    NEXT
    END

You should get the following result:

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100

The colon does not work here. I donīt know why.

Try some similar code with funny results:

    PUBLIC SUB Form_Open()
    DIM i AS Integer
    FOR i = 1 TO 100 STEP i
    PRINT i
    NEXT
    END

Or this code

    PUBLIC SUB Form_Open()
    DIM i AS Integer
    DIM x AS Integer
    FOR x = 1 TO 10
    FOR i = 1 TO 100 STEP x
    PRINT i & " ";
    NEXT
    NEXT
    END

-- ReinerHoffmann - 09 Aug 2004