HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

3- 15
| Substring * |
str_name
[
num_expr1,num_expr2
] | A$[1,5] |
|| ||
||
str_name
[
num_expr1;num_expr2
] | A$[5;3] |
|| ||
||
str_name
[
num_expr1
] | S$[5] |
|| ||
---------------------------------------------------------------------------------------------
Table 3-14 Note
* If the substring reference belongs to a string array variable,
str_name
must be an array element reference.
Variable Assignment
Numeric values must be assigned to numeric variables and string values
must be assigned to string variables. A substring reference results in a
string value that can be assigned to a string variable. Also, a string
value can be assigned to a substring on the left hand side of the
assignment statement.
Table 3-15 lists the types of values that can be assigned to variables.
Table 3-15. Possible Variable Assignments
---------------------------------------------------------------------------------------------
|| | |
| Variable | Can Be Assigned Value of | Example |
|| | |
---------------------------------------------------------------------------------------------
|| | |
| Numeric | Numeric variable | A=B |
| | Numeric expression | A=(B+3)*(C/5) |
| | Numeric literal | A=358 |
|| | |
---------------------------------------------------------------------------------------------
|| | |
| String | String variable | A$=B$ |
| | String expression | A$=B$+C$ |
| | String literal | A$="abcde" |
| | Substring | A$=B$[1,10] |
|| | |
---------------------------------------------------------------------------------------------
|| | |
| Substring | String variable | A$[1,5]=C$ |
| | String expression | A$[5]=C$+D$ |
| | String literal | A$[1;3]="abc" |
| | Substring | A$[1;3]=B$[1;3] |
|| | |
---------------------------------------------------------------------------------------------
When a string value is assigned to a string variable, the length of the
string variable becomes the current length of the string value. The
current length cannot exceed the maximum length of the string variable.
Several statements can assign values to variables. They are the
following:
ACCEPT LENTER READ
ENTER LET TINPUT
INPUT LINPUT