Fizz Buzz in Smalltalk

Published on 16 November 2024 (Updated: 16 November 2024)

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.

Current Solution

"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.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.