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, Function, Method, or Property 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 procedure, global data can be emulated easily by placing it inside a procedure returns data to the calling code. There is a limit of 64 Kilobytes and 16384 separate data items per procedure.
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