data item1 [,item2 ...]
This statement is used to list data constants (numbers or strings, quoted or unquoted) to be accessed by the
read statement. Each item must be a numeric or string constant; string constants may be quoted or unquoted. The items are separated by commas. Leading spaces (between a comma and the item that follows it, or between the
data keyword and the first item) are ignored; therefore, if you wish to represent a string item which contains commas and/or leading spaces, you must enclose it in quotes. Trailing spaces in an unquoted string item are not ignored; they're considered part of the string.
To represent a numeric item in a
data statement, you can use a decimal, hex, octal or binary constant.
You can have as many
data statements in your program as you like, and as many or as few items in each
data statement as you like. The only restriction is that the total number of data items (in all
data statements) must be at least enough to satisfy all
read requests. You can use the
restore statement to allow
data items to be read more than once.
data statements are global in scope: this means that any
read statement (whether it's in a local function, or in "main") can access any
data statement (whether it's in a (possibly different) local function, or in "main").
data statements are "non-executable," which means you can't change their effect by putting them inside a conditional execution structure such as
end if. However, you can conditionally include or exclude them from the program by putting them inside a
compile long if block.
Note that everything between the
data keyword and the end of the line is considered part of the
data statement. In particular, this means that you cannot use the "
:" separator to put another statement after the
data statement on the same line, and you cannot put a comment after the
data statement on the same line.