Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift Basics (retired) Control Flow While and Do-While Loop

Adan Huerta
Adan Huerta
3,209 Points

I am stuck... how do I print out each number in the array using a while loop and the println statement?

I think I am missing an earlier step from another video...

Marc Schultz
Marc Schultz
23,356 Points

It is a bad idea to present the entire solution to you. So what is your latest attempt?

2 Answers

Frezy Mboumba
Frezy Mboumba
3,642 Points

Yeah I definitely think that you are right Marc Schultz! My bad! Hey Adan , can you post your code please?

Adan Huerta
Adan Huerta
3,209 Points

Thanks everyone, I was missing the index syntax to get it going . I agree with you Marc, although this one was giving me a slight headache. -_- ( switching between Swift and Console Foundations courses have me drawing blanks on my Swift work. )

This got it working :

var index = 0 while index < numbers.count { println(numbers[index]) index++ }