## Checkpoint 3 - a cleaner solution

 Feb '22 Hi, I think this solutions is a bit cleaner than the proposed in the video. It prevents the nested code and the duplication of the check for the case 5: ``````for i in 1...100 { var text = "" if i.isMultiple(of: 3) { text += "Fizz" } if i.isMultiple(of: 5) { text += "Buzz" } print(text.isEmpty ? i : text) }`````` What do you think? Feb '22 Nice job! Indeed it is cleaner. Here'a challenge for you. Think about your solution, and reduce it to one line of code! Try it first before looking at > FizzBuzz in One Line 1 Feb '22 Ey @Obelix! It's cool you solutions, very interesting to play with it. But it's more difficult to read. Thanks for your review! Feb '22 Making that a one-liner is just mean to whomever follows you on future edits. After 35 years doing this, readable, maintainable code wins every single time. "Clever" gets nothing but contempt during a code review, updates, or bug fix. :D 1 Feb '22 Antonio chides: But it's more difficult to read. Chris agrees with: Making that a one-liner is just mean to whomever follows you on future edits. After 35 years doing this, readable, maintainable code wins every single time. Hey! I agree with both of you. I was just trying to have fun and test the boundaries. We had a lunchtime coding contest at work last year, and I submitted a similar entry, for fun. 2 Feb '22 Great! 💪 Jun '22 Hi sorry to bother you i really liked that approach But i cant really understand the print call. Could you maybe break it down for me? ^^ Jun '22 Remember both codes (Antonio's above and Obelix's linked) basically return the same thing - multiples of 3 are Fizz, multiples of 5 are Buzz and multiples of 15 are FizzBuzz. The key for me to understand Obelix's code was to replace the 🍺 with an i (that is what Antonio uses above). This is just a variable name and it can be anything you want. Personally, I think Obelix's version is hilarious and awesome! Can't wait to use this somewhere in my code just for the fun of it. 1

SAVE 50% To celebrate WWDC23, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.