If you need to concatenate two or more strings, use the + operator.
- If you place a quotation mark within a string, it may cause an error. To use a quotation mark within a string, use the escape code “.
An array is list or table of variables of the same data type. For example to create an array containing the names of colors you might use the code below.
Access an element of an array by using its index. For example to access the array element “orange”, use the code below.
- The first element in the array always has an index of 0. The last element in an array has an index one less than the size used to declare the array.
- You can declare and initialize an array at the same time as shown below.
If you don’t know how many elements will be in the array, you can declare it without a size as shown below.