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 trialgökhan sayılgan
2,285 Pointswhy do we need to define a range to numbers ?
here is my code that we don't need to define a range could you pleas check it
var number = 45 \ its bound to user input
if number % 15 == 0 { println("FizzBuzz") }else if number % 3 == 0 { println("Fizz") }else if number % 5 == 0 { println("Buzz") }else{ println() }
2 Answers
Stone Preston
42,016 Pointsyou dont have to define a range really. amit just does it so that you can see the program run with different numbers.
gökhan sayılgan
2,285 Pointsif a number divided by 3 and 5 at the same time it has to be dividable by 15 as math rule so there is no issue that why i didn't use "&& " command
gökhan sayılgan
2,285 Pointsthank you for your answer by the way :)
Stone Preston
42,016 Pointsgood point!