官术网_书友最值得收藏!

Arrays

Arrays are ordered collections of values and can hold any number of items, for example, a list of strings, ints, and floating-point values. Arrays are stored in an ordered list, starting at 0. Let's look at a diagram:

Starting from left to right in the preceding examples, we first have an array that holds a collection of strings. In the second example, we have another array that holds a collection of ints. In our third example, we have an array that holds a collection of mixed data values.

Now, let's review the following diagram, which is a mixed array:

Since this example contains mixed data types, such as strings, ints, and bools, we would have to name this an array type of Any. This means that we can have mixed data types inside our array. Until you are genuinely comfortable with arrays, I would not recommend using mixed data arrays. Try to stick to arrays with the same data type because you will know the exact data type of each element.

An array can hold any data type, but making the array strongly typed means that every element in it must be of the same type.

主站蜘蛛池模板: 雷州市| 虹口区| 娄烦县| 乐陵市| 甘谷县| 炎陵县| 佛教| 苗栗市| 西充县| 交口县| 萨嘎县| 寿宁县| 和硕县| 襄樊市| 北宁市| 北京市| 梁平县| 尼木县| 敦化市| 北海市| 正宁县| 乐业县| 青海省| 年辖:市辖区| 乌拉特中旗| 潜江市| 西峡县| 龙川县| 韶关市| 兴山县| 扎赉特旗| 合肥市| 同仁县| 西充县| 灌云县| 板桥市| 鸡东县| 陕西省| 临桂县| 五原县| 吉木乃县|