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 trialTahani Al-Shumrani
iOS Development Techdegree Student 2,022 Pointsi am still having problems with this challenge i am really stuck
i am still having problems with this challenge i am really stuck
func fizzBuzz(n: Int) -> String {
// Enter your code between the two comment markers
if (n % 3 == 0) && (n % 5 == 0){
return "FizzBuzz"
} else if (n % 3 == 0) {
return "Fizz"
} else if (n % 5 == 0) {
return "Buzz"
}
}
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHi...
You code is correct, but it looks like you deleted part of the pre-loaded code that needs to be there. The very last line (the return statement) is missing. Remember, unless specifically instructed to, what is loaded when the challenge opens needs to be left there. :)
The complete code will look like this:
func fizzBuzz(n: Int) -> String {
// Enter your code between the two comment markers
if (n % 3 == 0) && (n % 5 == 0){
return "FizzBuzz"
} else if (n % 3 == 0) {
return "Fizz"
} else if (n % 5 == 0) {
return "Buzz"
}
return "\(n)"
}
Keep Coding!
Tahani Al-Shumrani
iOS Development Techdegree Student 2,022 PointsTahani Al-Shumrani
iOS Development Techdegree Student 2,022 Pointsi managed to solve this challenge thank you so much