DATACOUNT function

Purpose

Return the total count of the number of local DATA items that can be read with the READ$ function.

Syntax

Count% = DATACOUNT

Remarks

DATACOUNT only returns the number of DATA items in the Sub or Function in which it appears (i.e., local DATA statements).  While it is not possible to directly read data from outside of the scope of current Sub or Function, global data can be emulated easily by placing it inside a Function that returns data to the calling code.  There is a limit of 64 Kilobytes and 16384 separate data items per Sub or Function.

See also

DATA, READ$

Example

FUNCTION GetCategories(Category() AS STRING) AS LONG

  LOCAL x AS INTEGER

  REDIM Category(1 TO DATACOUNT) AS STRING

  FOR x = 1 TO DATACOUNT

    Category(x) = READ$(x)

  NEXT x

  FUNCTION = DATACOUNT

  DATA Animal, Mineral, Vegetable, Alien

END FUNCTION