Talk:FizzBuzz

From Rosetta Code
Revision as of 04:25, 12 December 2007 by MikeMol (talk | contribs) (Puzzle)

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)

Puzzle talk

Why was this taken out of the puzzle category? As far as I can tell....it is a puzzle. Besides that, if it's not a puzzle, then what is it? --Mwn3d 14:03, 11 December 2007 (MST)

I removed it, since it's not a puzzle since no thinking is involved in solving it. All that it is, is writing the specification in the syntax of a language.
The thought is in how to do best do it in a given language. When the task first went up, most of the exaples used an if-elseif-else approach, which couldn't really be expanded efficiently. (See the FizzBuzzJazz comment above.) Also, compare the text of Template:Task and Template:Puzzle. Their goals differ slightly. While a normal task benefits more from syntactical and functional uniformity, a puzzle benefits from drawing out how different approaches affect efficiency. (Also...Sign your posts with --~~~~.) --Short Circuit 21:25, 11 December 2007 (MST)