Friday, November 2, 2012

Okay....so I lied:(

I did finish reading all of chapter 7 except for doing the exercises, which I naively thought I would breeze through. Which I did except for the 2nd example. Here's that code finished...FINALLY!!

Sublime Text 2: View



puts 'Say hello to your Grandma'


while true
input = gets.chomp
  if input == 'BYE'
puts 'See ya\' later gator  :)'
  break
  end

  if input != input.upcase
  puts 'HUH?!      SPEAK UP, SONNY!'

  else
  random_year = 1930 + rand(21)
puts ' No not since '  + random_year.to_s + ' !' ' ...it was a LONG time ago, as I recall.'


  end
end


Kind of fun actually, I tried coding it on my Droid using the "Ruboto IRB' and couldn't get it to work, kept getting:

 '=> NoMethodError: private method 'chomp' called for nil:NilClass (root) at deafgrandma.rb3 nil

So I see it has a problem with the Method 'chomp', and I see it's on line 3. I don't understand the 'private Method' part, gonna' look it up, and tell you all what I found out tomorrow.-Josh Kemp

P.S. If anyone knows or has seen this before, feel free to share your thoughts in the comments.