- iOS 12 Programming for Beginners
- Craig Clayton
- 114字
- 2021-07-02 15:04:59
Creating an array with initial values
Arrays can have initial values when they are created. Let's see how this would look by entering the following in Playgrounds:
let integers2 = [54, 29]
Your code will now look like this:

The array that we just entered uses type inference to declare the data type of the array using its initial values. In this case, Swift understands that it is an array of ints because the values we entered are integers. In addition, when we use a constant (let) on an array, we are telling Swift that the array is an immutable array, which means that the contents or size cannot change once it is instantiated.
推薦閱讀
- 計算機網絡與通信(第2版)
- 網絡協議工程
- RCNP實驗指南:構建高級的路由互聯網絡(BARI)
- Mastering Machine Learning for Penetration Testing
- 物聯網工程規劃技術
- 物聯網智慧安監技術
- 異構基因共表達網絡的分析方法
- Learning QGIS 2.0
- JBoss EAP6 High Availability
- Go Web Scraping Quick Start Guide
- 物聯網時代
- Learning Windows 8 Game Development
- 深入理解OpenStack Neutron
- 深入理解計算機網絡
- Getting Started with tmux