fizzbuzz = function (n) { return (n%3?'':'fizz')+(n%5?'':'buzz')||n } Mike 16th July, 2008 12:05 (UTC)

{

Good old javascript.

also:

fizzbuzz_style_game = function (rules) {

return function (n) {     var result = 
        for (var divisor in rules) 
            result += n%divisor?:rulesdivisor    return result || n}

}

my_buzz = fizzbuzz_style_game({

3:'fizz',
5:'buzz',
7:'is',
11:'a',
13:'simple',
17:'yet',
19:'interesting',
23:'game'

})

Good software can be changed easily. Parameterisation is the most powerful way to do this.

}