Talk:FizzBuzz

From Rosetta Code
Revision as of 19:24, 31 October 2007 by MikeMol (talk | contribs) (FizzBuzzJazz)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FizzBuzzJazz=

I wasn't satisfied with the approach most of the languages were taking, so I added a second approach to PHP, that uses the concatenation operator. I almost added a third code example as an extension of the puzzle, to demonstrate the approach.

I wanted to add a third term, "Jazz", to appear on multiples of 7. So 7 would have been "Jazz", 21/42/84 would have been "FizzJazz", 35/70 would have been BuzzJazz, and 105 (if the loop were to get that far) would have been FizzBuzzJazz. The if-else ladder approach would have needed three additional if statements to accommodate, while the concatenation approach would have needed only one.

This is probably a good time to point out that FizzBuzz is classified as a puzzle; As the header template suggests, "Multiple approaches are not discouraged." So if you've got a better way to solve the problem for a given language, let's see it! --Short Circuit 13:24, 31 October 2007 (MDT)