Well, it popped up again. Someone wrote "Why Can't Programmers... read". The author notes that of course, programmers hopped right on and provided their own solutions to the FizzBuzz test.
But, they did not read the specification! So, they got it wrong. Entirely wrong - but make comments like "I think the above solution is not elegant.". Whoops.
Here is my second take on it, in my 3rd favorite language - C:
[tkyte@desktop ~]$ cat test.c
for( i = 1; i<=100; i++ )
(i%3) ? "":"Fizz",
(i%5) ? "":"Buzz",
(snprintf(buff,sizeof(buff),"%d", i), buff):"" );
[tkyte@desktop ~]$ make test
cc test.c -o test
[tkyte@desktop ~]$ ./test
Man, it has been a while since I programmed C, I was a bit rusty - it did not compile the first time (second time is a charm).
I have to admit - more than once I've fallen into the "sorry, I read that too fast, you are right - that won't work" trap myself on asktom. That is one reason peer review is really important - no one lets a wrong answer get through :)