Skip to content

DIM (string)

Dimension String

This directive defines a string of a given length with the option to preset its value to a specific character.

DIM variable-name(length [,init-value])
[, variable-name (length [,init-value])...]
variable-name
is the name of a string variable.
length
is an integer in the range of 0 to 65000 specifying the initial number of characters the variable-name contains.
init-value
is a string whose first character is used as the character that fills the string variable-name. If this value is not specified and length is not 0, variable-name is preset to spaces.

Defining variable-name with a length of 0 erases the contents of variable-name and releases the memory space it occupied.

More than one variable can be dimensioned in a statement. Separate the variables by commas.

DIM DISK_SECTOR$(512, $00$)

defines a string variable whose length is 512 bytes and presets its value to null (hexadecimal zeros).

DIM STRING_VARIABLE$(1000, "MESSAGE")

constructs a string variable of 1000 bytes and loads it with the character “M”.

DIM SPACE_TAKER$(80)

defines a string variable that is 80 characters long and presets it to spaces.

DIM numeric array and DIM string array directives
DIM and PAD functions

From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF