PROGRAM single_column ! save data in a single column ! file$ example of string variable INPUT prompt "name of file for data? ": file$ ! channel number #1 associated with file and can be passed to ! subroutines ! various options may be specified in OPEN statement ! access output: write to file only ! create newold: open file if exists, else create new file OPEN #1: name file$, access output, create newold ! True BASIC does not overwrite data in a text file ! ERASE #1 ! erase contents of file ! RESET #1: end ! allows data to be added to end of file FOR i = 1 to 4 LET x = i*i PRINT #1: x ! print column of data NEXT i CLOSE #1 ! channel # irrelevant if only one open at a time OPEN #2: name file$, access input FOR i = 1 to 4 INPUT #2: y ! print column of data PRINT y NEXT i ! files automatically closed when program terminates CLOSE #2 ! not necessary but good practice END