This is a simple little piece of code that simulates a grandfather clock, it checks the current time and returns the hour by printing the word “Dong” once for each hour. It was an exercise in Chris Pine’s “Learn to Program” book.
I wanted to share some Ruby with you guys 🙂 Enjoy!
number = Time.now.hour
if number > (12)
number = number – (12)