A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Fizz Buzz in Smalltalk page! Here, you'll find the source code for this program as well as a description of how the program works.
"Loop 1 to 100"
1 to: 100 do: [ :i |
"If the number isn't divisible by 3 or 5, show the number"
i \\ 3 = 0 ifFalse: [i \\ 5 = 0 ifFalse: [Transcript show: (i printString); cr]].
"If the number is divisible by 3 AND 5, show 'FizzBuzz'"
i \\ 3 = 0 ifTrue: [i \\ 5 = 0 ifTrue: [Transcript show: 'FizzBuzz' ; cr]].
"If the number is only divisible by 3, show 'Fizz'"
i \\ 3 = 0 ifTrue: [i \\ 5 = 0 ifFalse: [Transcript show: 'Fizz' ; cr]].
"If the number is only divisible by 5, show 'Buzz"
i \\ 5 = 0 ifTrue: [i \\ 3 = 0 ifFalse: [Transcript show: 'Buzz' ; cr]].
].
Fizz Buzz in Smalltalk was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.