I ran across this just now (I know Runar posted on it earlier; I wasn't really paying attention then). So anyway, I opened up a workspace in BottomFeeder. Two minutes later:
| stream |
stream := WriteStream on: String new.
1 to: 100 do: [:index |
(index \\ 3) = 0
ifTrue: [stream nextPutAll: '(', index printString, ')', ' fizz '].
(index \\ 5) = 0
ifTrue: [stream nextPutAll: '(', index printString, ')',' buzz '].
(index \\ 3 ~= 0 and: [index \\ 5 ~= 0])
ifTrue: [stream nextPutAll: ' ', index printString, ' ']].
^stream contents
You might wonder why I dumped to a stream instead of the Transcript - well, I was doing this in my BottomFeeder runtime, so I didn't have a Transcript to dump to :) The output looks like this - I included the numbers in front of the Fizz and Buzz so I could be lazy about checking the output :)
1 2 (3) fizz 4 (5) buzz (6) fizz 7 8 (9) fizz (10) buzz 11 (12) fizz 13 14 (15) fizz (15) buzz
16 17 (18) fizz 19 (20) buzz (21) fizz 22 23 (24) fizz (25) buzz 26 (27) fizz 28 29
(30) fizz (30) buzz 31 32 (33) fizz 34 (35) buzz (36) fizz 37 38 (39) fizz (40) buzz
41 (42) fizz 43 44 (45) fizz (45) buzz 46 47 (48) fizz 49 (50) buzz (51) fizz 52
53 (54) fizz (55) buzz 56 (57) fizz 58 59 (60) fizz (60) buzz 61 62 (63) fizz
64 (65) buzz (66) fizz 67 68 (69) fizz (70) buzz 71 (72) fizz 73 74 (75) fizz (75) buzz
76 77 (78) fizz 79 (80) buzz (81) fizz 82 83 (84) fizz (85) buzz 86 (87) fizz 88
89 (90) fizz (90) buzz 91 92 (93) fizz 94 (95) buzz (96) fizz 97 98 (99) fizz (100) buzz
Update: Dohhh - what if it's both :)