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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Bobby Smith](https://secure.gravatar.com/avatar/03d6059db283e06425df9db1faade4d6?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Bobby Smith
1,985 PointsI have attempted this a couple of times, but I don't seem to come up with the proper solution
I have attempted this a couple of times, but I don't seem to come up with the proper solution
var results: [Int] = []
for n in 1...100 {
if n % 7 == n % 2 == 1
}
3 Answers
![jonlunsford](https://uploads.teamtreehouse.com/production/profile-photos/5288292/micro_IMG_3824.jpg)
jonlunsford
15,478 PointsAnthony: Here is one example. This code will check if the integer 21 is both a multiple of 7, and an odd number:
if (21 % 7 == 0) && (21 % 2 > 0) {
print("Yeah")
} else {
print("Neah")
}
This is just one way to do this. Note I have hardcoded conditional values. Both conditions must be true to print "Yeah" and if not it will print "Neah".
![jonlunsford](https://uploads.teamtreehouse.com/production/profile-photos/5288292/micro_IMG_3824.jpg)
jonlunsford
15,478 PointsAnthony, your IF statement is incomplete. I would go back and review the elements for an if statement. Also, the challenge is asking for multiples of 7. To check this you would check the condition that (n % 7 == 0). For example if n was 14, there would be no remainder since 14 is a multiple of 7, and this condition would evaluate to True. Then you need statements to do something in this case. Same thing for the other conditions. An IF statement should evaluate a condition then execute code if the condition is met.
![Bobby Smith](https://secure.gravatar.com/avatar/03d6059db283e06425df9db1faade4d6?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Bobby Smith
1,985 Pointsvar results: [Int] = []
for n in 1...100 if (n % 2 == 1) && (n % 7 == 0) { results.append() }
![jonlunsford](https://uploads.teamtreehouse.com/production/profile-photos/5288292/micro_IMG_3824.jpg)
jonlunsford
15,478 PointsYour code looks correct now, did it work for you?