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

EXAMPLES of REM Statement:
   10 REM CALCULATE AVERAGE VELOCITY
   20 FOR X= 1 TO 20 :REM LOOP FOR TWENTY VALUES
   30 SUM=SUM + VEL(X): NEXT
   40 AVG=SUM/20

RESTORE

TYPE: Statement
FORMAT: RESTORE

Action: BASIC maintains an internal pointer to the next DATA constant to be READ. This pointer can be reset to the first DATA constant in a program using the RESTORE statement. The RESTORE statement can be used anywhere in the program to begin re-READing DATA.

EXAMPLES of RESTORE Statement:
   100 FOR X=1 TO 10: READ A(X): NEXT
   200 RESTORE
   300 FOR Y=1 TO 10: READ B(Y): NEXT

   4000 DATA 3.08, 5.19, 3.12, 3.98, 4.24
   4100 DATA 5.08, 5.55, 4.00, 3.16, 3.37

   (Fills the two arrays with identical data)

   10 DATA 1,2,3,4
   20 DATA 5,6,7,8
   30 FOR L= 1 TO 8
   40 READ A: PRINT A
   50 NEXT
   60 RESTORE
   70 FOR L= 1 TO 8
   80 READ A: PRINT A
   90 NEXT

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