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 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...

operators.swift
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) {
    results.append(n)
    // End code 
}

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
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 !