Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Collections and Control Flow Control Flow With Conditional Statements Working With Logical Operators

Swift 3.0 Challenge!: Working with logical operators.

Help please. I really don't know what else to do...

var results: [Int] = [7, 21, 35, 49, 63, 77, 91]

for n in 1...100 {
    // Enter your code below
    if (n % 7 == 0) && (n % 2 != 0) {
    // End code 

3 Answers

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! Your logic is spot on given what is supposed to be appended to the results array. But we want that array to start as empty. You've worked out which are supposed to go in the array and put them in there yourself. But that's the code's job! So results needs to start out as an empty array just as it was at the beginning of the challenge.

Also, you're missing a closed curly brace. Your for loop starts with an open curly and has a closed curly brace. Your if statement has an open curly brace, but no closed curly brace.

When I fix these two small issues, your code passes! Hope this helps! :sparkles:

aha! So much to keep in mind of hehe. But now i got it, can't do what the computer needs to do for me xD Thank you!

This still isnt working for me please help !