Corona – Arrays

The Array

Let’s talk Arrays. In any language an Array is variable that holds a list of values. Array sounds so technical. Just call it a list, everyone understands a list. Here’s an example:

{ "Apples", "Bananas", "Cherries" }

Note the syntax. The whole thing is wrapped in the { (left curly brace) and the } (right curly brace). These define the extent of the list. Each list item is separated by a comma (,).

Make an array

Try it yourself. Make a new Corona project and type the following into main.lua. Below I have defined a local variable and set it equal to an array.

local fruit_array = { "Apples", "Bananas", "Cherries" }

Continue reading Corona – Arrays