4 ms·
the article has a special string that says "fizz buzz", they saying its unnecessary because if you go in order you first print "fizz", then print "buzz" which
by tayo42 1y ago
the article has a special string that says "fizz buzz",
they saying its unnecessary because if you go in order you first print "fizz", then print "buzz" which will always print "fizz buzz" for the equivalent of " mod 15" you don't need a special string that like.
the "if (m3 || m5)" is just printing a newline because under that condition you printed something earlier.
- hnlmorg 1y agoIt’s still an extra condition. So it really doesn’t matter if you’re printing “Fizz Buzz” string or not, it’s the same amount of branching.
- airstrike 1y agoadd another bool that stores the information to write a newline whenever either fizz or buzz happen and you don't need the third branch