Commodore 64 User Manual page 128

Hide thumbs Also See for 64:
Table of Contents

Advertisement

OPEN 1,4 OPENS device #4, which is the printer
CMD 1 All normal output now goes to printer
LIST The program listing now goes to
the printer, not the screen
To send output back to the screen , CLOSE the file with CLOSE 1.
DATA
This statement is followed by a list of items to be used by READ
statements. Items may be numeric values or text strings, and items are
separated by commas. String items need not be inside quote marks
unless they contain space, colon, or comma. If two commas have noth-
ing between them, the value will be READ as a zero for a number, or an
empty string.
DATA 12, 14.5, "HELLO, MOM", 3.14, PART1
DEF FN
This command allows you to define a complex calculation as a func-
tion with a short name. In the case of a long formula that is used many
times within the program, this can save time and space.
The function name will be FN and any legal variable name (1 or 2
characters long). First you must define the function using the statement
DEF followed by the function name. Following the name is a set of pa-
rentheses enclosing a numeric variable. Then follows the actual formula
that you want to define, with the variable in the proper spot. You can
then "call" the formula, substituting any number for the variable.
10 DEF FNA (X) = 12*(34.75 - X/.3)
20 PRINT FNA(7)
T
T
7 is nserted where
X is in the formula
For this example , the result would be 137.
DIM
When you use more than 11 elements of an array, you must execute a
DIM statement for the array. Keep in mind that the whole array takes up
118
I&I
0
0

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Commodore 64

Table of Contents