Section 1 - Instruction

So far, each variable we've used holds just one piece of data, like a single number or string.

But what if you need to store multiple related items together, like all the player names in a game or items in an inventory?

Engagement Message

How might you group related values?

Section 2 - Instruction

Swift provides a way to store an ordered collection of items: an array.

You create arrays using square brackets [], with items separated by commas. For example: [1, 2, 3].

Engagement Message

What punctuation separates items inside an array?

Section 3 - Instruction

Arrays work best when they contain items of the same data type, like all integers or all strings.

Example: [10, 20, 30] or ["red", "green", "blue"]

Imagine you're tracking your daily steps for a week.

Engagement Message

Would an array be a good way to store the number of steps for each day?

Section 4 - Instruction

Just like other data types, you assign an array to a variable using the equals sign =.

Engagement Message

How would you create a variable primes holding the numbers 2, 3, and 5?

Section 5 - Practice
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal