myArray = “yellow balloon”; myArray = “red balloon”; myArray = “blue balloon”; myArray = “pink balloon”;
Just so you don’t get too carried away, there actually is a limit to the number of elements that you can have in an array, although you’re very unlikely to ever reach it. The limit is 4,294,967,295 elements.
In addition to naming requirements (which are the same for any type of variable, arrays have a couple of other rules and special properties that you need to be familiar with:
Arrays are zero-indexed
Arrays are zero indexed
What this means for you is that myArray is actually the fourth element in the array.
Zero-based numbering is a frequent cause of bugs and confusion for those new to programming, but once you get used to it, it will become quite natural. You may even discover that there are benefits to it, such as the ability to turn your guitar amp up to the 11th level.
Arrays can store any type of data
While you can store any type of data in an array, you can also store elements that contain different types of data, together, within one array.
item = “apple”; item = 4+8; item = 3; item = item * item;