+ 1

Are there only two ways of accessing arrays in swift?

Only .count and isEmpty can be used to access arrays?

8th Sep 2020, 7:59 AM
Sreenesh
Sreenesh - avatar
5 Answers
+ 1
No, there are much more. For example you can index them using square brackets: array[0] and you will get the item at index 0
8th Sep 2020, 9:35 AM
Seb TheS
Seb TheS - avatar
+ 1
Ok thanks but in solo learn course in accessing only these were given
8th Sep 2020, 10:09 AM
Sreenesh
Sreenesh - avatar
8th Sep 2020, 12:13 PM
Seb TheS
Seb TheS - avatar
+ 1
There are other ways: Example you can use the insert(at:) method to input values at a particular location. Her is a code I made, and it should help you out. https://code.sololearn.com/c8EC5cm47YRq/?ref=app
10th Sep 2020, 3:22 PM
đŸ”„ Destiny đŸ”„
8th Sep 2020, 12:16 PM
Sreenesh
Sreenesh - avatar