FutureBasic Logo

<<    Index    >> FutureBasic 5

index$ D   statement



Syntax:
index$ D (element [,indexID])

Description:
This statement deletes an element from one of the special index$ string arrays (see the index$ statement and the clear <index> statement for information about how index$ arrays are created). The indexID parameter specifies which of the index$ arrays (0 through 9) to delete an element from ; if this parameter is omitted, index$ array 0 is used. The element parameter specifies which element to delete.
The index$ D statement does not merely assign a null string to the indicated element. Instead, it moves all of the subsequent array elements in memory, in order to fill the "gap" left by the deleted element. As shown in the diagram, this also affect the element numbers by which the moved strings are identified.
This statement is the complement of index$ I, which inserts an element into the array.

Example:
This illustrates the difference between deleting an element using index$ D, and "clearing" an element by assigning a null string to it.

INDEX$
element #contents
4Sandy
5Joshua
6Carrie
element #contents
4Sandy
5Carrie
Before After


INDEX$(5) = ""
element #contents
4Sandy
5Joshua
6Carrie
element #contents
4Sandy
5
6Carrie
Before After

See Also:
CFIndexSort; clear <index>; index$ I; index$ function; index$ statement; indexf; mem