Smalltalk snippet of the day: Fizz Buzz
Wednesday, February 28th, 2007The spec. is: print the numbers from 1 to 100, except where a number is divisible by 5, print “Fizz”, and where divisible by 7, print “Buzz”. Where divisible by both, print “Fizz Buzz”.
1 to: 100 do:
[ :i | | fb |
fb := (#((5 'Fizz') (7 'Buzz'))
[...]