Creating and Using Tables

Tables are defined using the Table and End Table keywords and are stored in program memory.  Entries are placed into the program with the Data keyword.

Table PowerOfTwo as uLong
 
  Data 1,2,4,8,16,32,64,128,256,512,1024
  Data 2048,4096,8192,16384,32768,65536
 
End Table
 

Tables are then used through the Read and Restore keywords.   Before reading from a table, the table pointer should be initialized by use of the Restore keyword, or using Read with table and index parameters.

Restore(PowerOfTwo)
a=Read()             ' a is now 1
a=Read()             ' a is now 2
a=Read()             ' a is now 4
a=Read(PowerOfTwo,9) ' a is now 512 

Note when using the index parameter: Data in a table starts with an index of 0 not 1.

See Table, Data, Read, Uses, Restore