Ruby sample code

tbpgr
2,063 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Next: Fibonacci

FizzBuzz

FizzBuzz
1
2
3
4
5
6
7
8
(1..100).each do |n|
puts case 0
when n % 15 then :FizzBuzz
when n % 3 then :Fizz
when n % 5 then :Buzz
else n
end
end
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content