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 trialDaniel Lambrecht
iOS Development Techdegree Student 5,302 Pointsive done exactly like the solution video?
it tells me that i need to double check my logic for buzz and that i am returning the correct string?
func fizzBuzz(n: Int) -> String {
// Enter your code between the two comment markers
for i in 1...100 {
if (i % 3 == 0) && (i % 5 == 0) {
return "FizzBuzz"
} else if (i % 3 == 0) {
return "Fizz"
} else if (i % 5 == 0) {
return "Buzz"
} else {
print(i)
}
}
// End code
return "\(n)"
}
1 Answer
Jorge Solana
6,064 PointsHey Daniel!
I don't think a for loop is necessary. I think challenge is asking to get that "n" variable you're receiving and create a switch statement with that.
Give it a try, hope it helps!