3 ms·
Ah, no, I have been reading it wrong, the code is correct: given the "i % 3 ∧ i % 5" in the first case, the "i % 5" for the "Fizz" case is effectively an "i % 3
by fhars 7y ago
Ah, no, I have been reading it wrong, the code is correct: given the "i % 3 ∧ i % 5" in the first case, the "i % 5" for the "Fizz" case is effectively an "i % 3 = 0". Clever. Readable? Maybe.
- kragen 7y agoRight, multiples of 3 print "Fizz", and multiples of 5 print "Buzz". It would be clearer to pattern-match on the tuple (i % 3 == 0, i % 5 == 0), or even (i % 3, i % 5), but at that point I haven't introduced pattern-matching.
- samatman 7y agoClever, yes. Readable? Eh, Fizzbuzz is an opportunity to stot. I'll allow it ;)