Arrays
An array can hold a collection of variables (of any type) together under a single name. Defining an Array
An array is defined like this.... int n[] Dim n[10] or this... int n[10] The number specified in the square brackets is the number of elements to be in the array. This makes n an array of 10 integer values. This can also be done with strings and floating point numbers. float number[10] string name[10] Accessing Array Values
Individual values can be accessed from the array using by using an index after the variable name. n[5]=7 This sets element 5 of array n to hold the value 7. If we try to access an element that is not contained in the array.... n[10]=7 .... TNT Basic will return an index out of bounds error because the array has not been defined to contain that element number. Arrays can be accessed with index zero all the way up to the size of the array less one. So for an array of 10 elements, valid indicies are 0..9.
Table of contents