Monday, September 23, 2013

Noob Tutorials #1 Ruby Code

I will be going through the Learn To Program Ruby book. So for the first week i did chapters 1-4 and the firs assignment was.

Hours in a year. How many hours are in a year?
Minutes in a decade. How many minutes are in a decade?
Your age in seconds. How many seconds old are you?

and the answer is.

puts 24 * 365 

puts 60 * 24 * 365 * 10

puts 60 * 60 * 24 * 365 * 15

to do this you will need a code editor, I'm currently using TextWrangler. To execute my ruby programs, I will be the command line. To get to the command line on a Mac, use the Terminal application (you can find it under: /Applications/Utilities/Terminal.app. I'm using this book: Learn to Program by Chris Pine.

No comments:

Post a Comment