Wednesday, October 31, 2012

Oct. 30th after midnight...

Another sample exercise from chapter 4 from 'Learn to Program':

Sublime Text 2:


puts 'Yo, what up dawg?...hey what\'s yo favorite number?'
number = gets.chomp.to_i
mynumber = number + 1
puts 'What are you kidding me? '+number.to_s+' ???? .........'+mynumber.to_s+ ' really is a much better number!'

...And from terminal.


Last login: Wed Oct 31 00:09:07 on ttys000
Joshuas-MacBook-Pro:~ joshuakemp$ ruby bigger.rb
Yo, what up dawg?...hey what's yo favorite number?
39
What are you kidding me? 39 ???? .........40 really is a much better number!
Joshuas-MacBook-Pro:~ joshuakemp$
Goodnight = Josh tired
puts 'See you tomorrow'