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 trialEleanor Campbell
8,630 Pointscannot assign to value: binary operator returns immutable value.
for n in 1...100 { if 0 != (n % 2) && 0 = (n % 7) { print(n) } } this is what i was experimenting with in my playground to figure out why I couldn't pass the code challenge. it kept telling me I didn't have a conditional statement. now in the playground I get the message above.
3 Answers
Kevin Rosario
2,655 PointsTry to put n % 7 == 0 and then && n % 2 != 0, probably treehouse is looking for that specific order.
Kevin Rosario
2,655 PointsIn if statements you would put the question first, for example instead of 0 != (n % 2), you would write n % 2 != 0, and also the challenge is asking you to append n, so instead of print() you are going to append n to results by writing results.append() and the scoped variable n goes inside the brackets.
Eleanor Campbell
8,630 Pointsyeah that's what i tried first and it gave me the same problem.
Kevin Rosario
2,655 PointsMan, sometimes is just a little bit hard to spot does small syntax errors, I'm glad I could help.
Eleanor Campbell
8,630 PointsEleanor Campbell
8,630 Pointsit was the == on n % 7 == 0, I had a single =.