This example demonstrates several valid STRING declarations.
STRING/STR(132),STG(5,10)
STRING/MESS(10,5,125)
These two declarations define the following string variables.
Variable |
Description |
STR |
A simple variable, capable of storing 132 characters. |
STG |
A one dimensional string array, STG contains 5 elements with each element capable of storing a maximum of 10 characters. |
MESS |
A two dimensional string array. MESS contains 50 elements (10 x 5) with each element capable of storing a maximum of 125 characters. |
Simple string variables and elements of string arrays are initially set to zero. For example, execution of the following program segment assigns the string 'ENTERTEXT' to the variable S. The string variable T was initialized to length zero and therefore has no effect on the result.
STRING/S(50),T(5)
S='ENTER'+T+'TEXT'
PRINT/S
HALT
The following text would be printed to the listing window:
ENTERTEXT