Skip to content

Commit

Permalink
Add examples for RESTORE and RETURN
Browse files Browse the repository at this point in the history
  • Loading branch information
jestin committed Nov 29, 2023
1 parent 8deae1f commit 6a2efad
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions appendix/basic_commands.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,25 @@ \subsection{RESTORE}
always directs the next {\ttfamily READ} back to the first {\ttfamily DATA}
statement.\\

Example:\\

\codeblock{

10 READ A\$\\
20 PRINT A\$\\
30 READ A\$\\
40 PRINT A\$\\
50 RESTORE\\
60 READ A\$\\
70 PRINT A\$\\
80 DATA "FIRST","SECOND"\\

}

Despite the above program {\ttfamily READ}ing three times yet only having
enough data for two reads, it runs without error because {\ttfamily RESTORE}
causes the first piece of data to be read twice.\\

\subsection{RETURN}

The {\ttfamily RETURN} statement is always used in conjunction with the
Expand All @@ -2465,6 +2484,22 @@ \subsection{RETURN}
statement when its list of {\ttfamily GOSUB}s is empty, it will cause a
{\ttfamily RETURN WITHOUT GOSUB ERROR}.\\

Example:\\

\codeblock{

10 PRINT "FIRST"\\
20 GOSUB 50\\
30 PRINT "FOURTH"\\
40 END\\
50 GOSUB 80\\
60 PRINT "THIRD"\\
70 RETURN\\
80 PRINT "SECOND"\\
90 RETURN\\

}

\subsection{SCREEN}

<TODO>
Expand Down

0 comments on commit 6a2efad

Please sign in to comment.