4 ms·
I don't understand your objection.
by Jabbles 5y ago
I don't understand your objection.
- eggy 5y agoA lot of the rosetta code examples show the simple and the more complex example or less use of built-in functions to show they can express it with the core language.
- Jabbles 5y agoSure, but I think that's a different objection?
- OskarS 5y agoI think he's saying that inside of the loop in FizzBuzz, it should look like something like this (Python-esque pseudocode, assuming for a second print() doesn't add a newline automatically): if x % 3 == 0: print("Fizz") if x % 5 == 0: print("Buzz") if x % 3 != 0 and x % 5 != 0: print(x) print("\n") i.e. no special "FizzBuzz" case for when it's divisible by 15, it just naturally falls out of the first two if's. It's a bit of a silly objection though, the it's fine to write it as the author did.
- alexeldeib 5y agoas I learned above you can use the "end" kwarg to avoid the newline: print("Fizz", end="")
- CRConrad 5y agoThat doesn't work here, though, because then you don't get "FizzBuzz" for 15 -- you get "Fizz" and "Buzz" on separate lines.