BASIC-SO

Commands and Statements

PUT file number, [sector number]

10OPEN "R", 1, ":F1:FILE.1"

20FIELD 10 AS A$

30INPUT A$

40PUT 1,1

50CLOSE 1

60STOP RUN

? "A STRING" Ok

RANDOMIZE

The RANDOMIZE statement prompts the user for a new random number seed for the random number function RND. If the RANDOMIZE command is not given within a program, the same sequence of random numbers will repeat each time any program is run.

RANDOMIZE [(expression)]

If the optional expression is included, its value becomes the new seed and no prompt is issued.

10RANDOMIZE

20A= RND

30IF A < .5 THEN PRINT "HEADS"

40IF A >= .5 THEN PRINT "TAILS"

RUN

Random number seed (0-65529)? 123

TAILS Ok

READ

The READ statement sequentially assigns values found in the accompanying DATA statements to the variables specified. If more DATA fields are read than are available, an OUT OF DATA error message will be printed. If there is still data available to be read, the next READ statement will assign the next datum to the specified variable. The READ pointer may be reset to the first item of any DATA statement with the RESTORE command. Any type of variable may be read as long as the type of the DATA is appropriate for the type of variable.

READ variable [,variable] ...

10DATA 2,4,6,8,10,12,14,16,18,20

20READ A, B,C,

30PRINT A; B;C

40READ D,E,F

50PRINT D;E;F

RUN

81012 Ok

6-19

Page 59
Image 59
Intel 9800758-02 manual Randomize, Read