[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

STEP

TYPE: Statement
FORMAT: [STEP <expression>]

Action: The optional STEP keyword follows the <end-value> expression in a FOR statement. It defines an increment value for the loop counter variable. Any value can be used as the STEP increment. Of course, a STEP value of zero will loop forever. If the STEP keyword is left out, the increment value will be + 1. When the NEXT statement in a FOR loop is reached, the STEP increment happens. Then the counter is tested against the end-value to see if the loop is finished. (See FOR statement for more information.)

NOTE: The STEP value can NOT be changed once it's in the loop.

EXAMPLES of STEP Statement:

   25 FOR XX=2 TO 20 STEP 2             (Loop repeats 10 times)
   35 FOR ZZ=0 TO -20 STEP -2           (Loop repeats 11 times)

STOP

TYPE: Statement
FORMAT: STOP

Action: The STOP statement is used to halt execution of the current program and return to direct mode. Typing the <RUN/STOP> key on the keyboard has the same effect as a STOP statement. The BASIC error message ?BREAK IN LINE nnnnn is displayed on the screen, followed by READY. The "nnnnn" is the line-number where the STOP occurs. Any open files remain open and all variables are preserved and can be examined. The program can be restarted by using CONT or GOTO statements.

EXAMPLES of STOP Statement:
   10 INPUT#1,AA,BB,CC
   20 IF AA=BB AND BB=CC THEN STOP
   30 STOP
                   (If the variable AA is -1 and BB is equal to CC then:)
 BREAK IN LINE 20
 BREAK IN LINE 30        (For any other data values)

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated November 14, 1998.