Properties in Swift, allow us to access a value that is specific to a particular structure. We can use the .count property of an array to give us a number value of elements inside the array.

For example, suppose we have an array called grocery with some emojis:

var grocery = ["πŸ₯“", "πŸ₯ž", "πŸͺ", "πŸ₯›", "🍊"]

When we print out grocery.count:


The output will look like this:


This property will come in extra handy when the array is lengthy.



It takes too long to count the number of elements in countingRhyme with your eyes.

Print the size of the array using .count.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?