# [SWIFT] Let's understand the Array (Element) type!

Now that we've learned about the Array (Element) type, we'll output it.

• The following content is for the output of the learning content, so there may be errors. Please note

# What is Array (Element) type?

*** Array (Element) type is a type that represents an array in a nutshell. *** ***

For example Array (Element) types can be represented using array literals, such as [1,2,3].

#### `qiita.rbvar `

``````
1.let a = [a,b,c]
2.let b = [1,2,3]

``````

It is convenient to use the Array (Element) type. You can update, add, join, and delete *** elements for Array (Element) type values.

Let's dig deep one by one!

# Element update

#### `qiita.rbvar `

``````
//0 1 2
1.var numbers = [1,2,3]
2.numbers[1] = [4] //We are updating the first 2
numbers// [1,4,3]

``````

*** Use the *** append (_ :) *** method to add an element to the end *** The following example adds a "d" of type [String]

#### `qiita.rbvar `

``````
1.let strings  = ["a","b","c"]
2.strings append(d)//["a","b","c","d"]
``````

You can also add it to any *** location. To add an element in any *** location, use the *** insert (_: at: 1) ***, method.

In the following example, nsert (_: at: 1) ***, method is used and "b" is added second.

#### `qiita.rbvar `

``````
1.let strings  = ["a","c","d"]
2.strings insert("b",at1)//["a","b","c","d"]
``````

# Combine elements

You can combine elements of type Array (Element) with the + operator.

#### `qiita.rbvar `

``````
1.let strings1 = ["Ah","I","U"]//[String type]
2.let c =["e","O"]//[String type]

let result = strings1+let c //["Ah","I","U","e","O"]
``````

# Delete element

To remove an element, delete anywhere *** remove (at :) ***, remove the last element *** removeLast () ***, removeAll () method to remove all elements Three are prepared.

#### `qiita.rbvar `

``````
var strings = ["Ah","I","U","e","O"]

strings.remove(at:2)
strings//["Ah","I","e","O"]//"U"Is deleted

strings.removeLast()
strings//["Ah","I","e"]//At the end"O"Is deleted

strings.removeAll()
strings//()

``````