iOS Swift Collections and Control Flow Control Flow With Loops While and Repeat While

dakota ferrell
dakota ferrell
2,201 Points

.count

what does .count do in the while loop with todo.count?

1 Answer

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,861 Points

It gives you the number of elements that the todo array contains. So the condition in the while loop says:

If the number contained in index is less the the number of elements in the todo array, run the code in the loop.

Hope this helps!