Futurebasic/Language/Reference/clear index

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Clear Index

CLEAR <index>[edit | edit source]

Statement[edit | edit source]

(+) Appearance (+) Standard (+) Console

Syntax[edit | edit source]

To allocate, increase or decrease memory for INDEX$ arrays:
1. CLEAR bytes& [,indexID]
2. CLEAR numElements&, indexID, eltSize

To release the memory used by existing INDEX arrays:
3. CLEAR-1
4. CLEAR INDEX$ [indexID]

Description[edit | edit source]

Use syntax (1) or (2) to allocate memory for an INDEX$ string array, and to specify whether the array shall consist of fixed-length or variable-length cells for the strings. Using fixed-length cells provides greater speed but may require more memory. Using variable-length cells provides more efficient use of memory, but processing may be slower. You must use Syntax (1) or (2) to allocate memory for an INDEX$ array before the array will function.

Use Syntax (1) to specify the total number of bytes to be allocated for a variable-cell-length INDEX$ array. The indexID parameter indicates which of the ten available INDEX$ arrays (numbered 0 through 9) to allocate space for. If you omit this parameter, space will be allocated for INDEX$ array #0.

Use Syntax (2) to specify the number of elements to be allocated for a fixed-cell-length INDEX$ array. The eltSize parameter should be in the range (1..256); it fixes the size of the cells. You can store a string of up to (eltSize - 1) characters in such a cell. The indexID parameter indicates which INDEX$ array (0 - 9) to allocate space for.

You can also use Syntax (1) or (2) to increase or decrease the amount of memory allocated for an existing array. This is sometimes useful if you find you need more (or less) memory than you originally allocated. If you increase the memory allocation, none of the existing strings in the array will be affected. If you want to decrease the memory allocation without affecting the existing strings, make sure you don't specify too small a number; you can use the MEM function to determine how much memory the existing strings occupy.

Use Syntax (3) or (4) to release the memory previously allocated for one or more INDEX$ arrays. Syntax (3) releases the memory occupied by all existing INDEX$ arrays. Syntax (4) empties each string in an INDEX$ array without releasing memory occupied by the array. If you omit the indexID parameter, then INDEX$ array #0 is used.

See Also[edit | edit source]

INDEX$ STATEMENT
INDEX$ D
INDEX$ I
INDEX F