Swift 2.0 Syntax Array

Source: Internet
Author: User

Import UIKit

/*:

Array

* format var arr:[int] = [ value 1, value 2, value 3]

* non-variable group let = = Nsarray

* variable array var

*/

Let arr = [ten, one, one] // developed with this

Let arr2: [Int] = [ten, one, one]

Let arr3: Array<Int> = [ten, one, one]

Note : If the first definition is initialized , then the data type must be specified at the time of definition

var arr4:[Int]

ARR4 = [ten, one, one]

How to create an empty array

var arr5 = [Int] ()

cannot append content to immutable array

Arr.append (20)

Find

ARR4[0]

Modify

ARR4[0] =

Arr4

Append

ARR4. Append(998)

Delete

ARR4. Removeatindex(0)

Arr4

ARR4. RemoveAll()

Arr4

array Open Storage rules : multiples of 2

ARR4. Capacity

ARR4. Append(a)

ARR4. Capacity

ARR4. Append(one)

ARR4. Capacity

ARR4. Append(+)

ARR4. Capacity

ARR4. Append(+)

ARR4. Append(998)

ARR4. Capacity

ARR4. Append(998)

ARR4. Append(998)

ARR4. Append(998)

ARR4. Append(998)

ARR4. Capacity

Traverse

For number in arr4

{

Print(number)

}

Swift 2.0 Syntax Array

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.