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 trialRaymond Espinoza
1,989 Pointsfizzbuzz
cant seem to solve this code .
func fizzBuzz(n: Int) -> String {
// Enter your code between the two comment markers
var n = 3 "buzz"
// End code
return "\(n)"
}
1 Answer
warp42
3,171 PointsHonestly, you might want to go back to some of the previous videos to brush up on your basics.
Some ideas where to start...
- Read up on your operators. In this case, specifically the equivalence operator (==) and the logical "AND" operator (&&). Using the = sign will declare a variable, not check for equivalence)
- How to print statements ( you're missing "print" and it should be on a second line)
- You're not checking for Fizz, or FizzBuzz. You have to check n against all three possibilities.
- How to use the "remainder" operator (%)
- If it says put code between the two comment markers ("//"), I would suggest following those instructions as the compiler might not read it correctly.