HTBasic Help
×
Menu
Index

DATA

Stores data items in the program.
 
 DATA [data-item] [,data-item...]
 
Usage:
DATA 1.9,"Counts",3.14,56,"Number of Events"
DATA item1,item2,item3
DATA "comment-tail: !","comma: ,","quote: """
DATA 1984,Number of Days
 
Example: DATA.BAS
 
Description:
DATA and READ statements can quickly and easily provide values for program variables. All DATA statements in a context form a single data list. Each context (main program and subprograms) has its own data list. Each variable in the variable list of a READ statement picks up a value from the DATA list, starting in sequence: the first variable in a READ picks up the first value in the data list, then the next variable picks up the next value, etc. When a subprogram is called, the current point in the sequence is remembered and restored when control returns to the calling context.
 
The DATA items are treated as literals making it necessary for the computer to process the numeric variables with the VAL function. An error is generated if string values are found in numeric variables, but numeric values may be placed in string variables. Leading and trailing blanks are deleted from unquoted literals. Unquoted literals cannot contain quote marks, comment tails or commas. To include one of these characters in a literal, you must use quotation marks around the literal. A quotation mark is included inside the literal by using two quote marks in the place where you wish to have one. To include a COMPLEX number in a DATA statement, list the real and imaginary parts separately, separated by a comma.
 
You can make a READ start at the beginning of any DATA statement by using a RESTORE command.
 
See Also: