DEV Community

Jocelyne1124
Jocelyne1124

Posted on

Week 5 discussion

  1. Why do you think arrays in Swift only support a ​collection of objects of the same type. This is so that the array can be read easier and things can be kept clean. For example if you'd like to create a function where you are adding two numbers from the array and the index that you are using falls on a string, the program will return an error.

  2. How can you access objects within an array one at a time? you would call them based on their index for example arrayX.5

  3. How might you check if an array is empty? This can be done by checking isEmpty.arrayX

Top comments (0)