qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
REDIM Statement Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
REDIM Statement Programming Example
 
This example shows how to use REDIM to allocate an array of records and
then how to free the memory that the records use.
 
TYPE KeyElement
   Word AS STRING * 20
   Count AS INTEGER
END TYPE
 
' Make arrays dynamic.
' $DYNAMIC
CLS                          ' Clear screen
' Allocate an array of records when you need it.
REDIM Keywords(100) AS KeyElement
Keywords(99).Word = "ERASE"
Keywords(99).Count = 2
PRINT "Keyword 99 is "; Keywords(99).Word
PRINT "Count is"; Keywords(99).Count
' Free the space taken by Keywords when you're finished.
ERASE Keywords
END
 
Sample Output
 
Keyword 99 is ERASE
Count is 2