An array can store a group of values, but the values must be?

An array is a collection of data that can be accessed with an index. They are useful for storing groups of values, but they must have the same type and size.

The following article will explain what arrays are, how to create them, and more!

Keywords: Array, data, collections

literature, book, wisdom @ Pixabay

Array Basics: Arrays can store a group of values, but the values must be of the same type and size. They are often used for storing groups of related information like an address book or shopping list. Here is how you create one!

Create an Array: To declare that we want to use an array with string types, we would type this in our code below (note that it will not compile yet): var myStrings = new String[]{‘apple’, ‘banana’, ‘orange’}; //declares and creates a two-item array with strings var fruits = [‘Strawberries’, ‘Lemons’] //creates another two-item array – both items have to be the same.

Leave a Reply

Your email address will not be published. Required fields are marked *