Download HP BASIC for OpenVMS Reference Manual

Transcript
DATA
•
HP BASIC does not execute DATA statements. Instead, control is passed
to the next executable statement.
•
A program can have more than one DATA statement. HP BASIC assembles
data from all DATA statements in a single program unit into a lexically
ordered single data block.
•
HP BASIC ignores leading and trailing blanks and tabs unless they are in
a string literal.
•
Commas are the only valid data delimiters. You must use a quoted string
literal if a comma is to be part of a string.
•
HP BASIC ignores DATA statements without an accompanying READ
statement.
•
HP BASIC signals the error ‘‘Data format error’’ if the DATA item does not
match the data type of the variable specified in the READ statement or if a
data element that is to be read into an integer variable ends with a percent
sign ( % ). If a string data element ends with a dollar sign ( $ ), HP BASIC
treats the dollar sign as part of the string.
Example
10 DECLARE INTEGER A,B,C
READ A,B,C
DATA 1,2,3
PRINT A + B + C
Output
6
3–34 Statements and Functions