Level 0, lesson 15

# 0.15 Using arrays of numbers

You can use arrays of numbers just like variables. The array cells are numbered from 0 to N, N being the size of the array minus one. Storing a value in the 0th cell is easy. It works just like a simple variable:

         5 sixteen 0 th !

Which will store '5' in the 0th cell. So storing '7' in the 8th cell is done like this:

         7 sixteen 8 th !

Of course when you want to store a value in the first, second or third cell you have to use 'TH' too, since it is a word. If you don't like that try defining 'ST', 'ND' and 'RD' yourself:

         : st th ;
         : nd th ;
         : rd th ;
         4 sixteen 1 st !
         5 sixteen 2 nd !
         6 sixteen 3 rd !

Isn't 4tH wonderful? Fetching is done the same of course:

         sixteen 0 th @
         sixteen 4 th @

Plain and easy.