The idea was to save space. Why rewrite the same 3 lines of code every time the computer doesn't understand your input? So I came up with this:
didnotget = Proc.new do |goback|
puts 'I\'m sorry, I don\'t follow that command. Please try again.'
goback
end
puts 'I\'m sorry, I don\'t follow that command. Please try again.'
goback
end
This proc SHOULD come up any time the computer doesn't understand what's happening, and the variable at the end of the proc is used to recall the method the user was just on. This isn't working the way I wanted it to, because instead I get this error:
rpsgame.rb:91:in `initialize': undefined local variable or method `didnotget' for # (NameError)
from rpsgame.rb:122:in `new'
from rpsgame.rb:122
from rpsgame.rb:122:in `new'
from rpsgame.rb:122
Ah well, I'll figure it out eventually. For now, I'm going to grab a taco from Casa at the Oxbow in Napa, and then get some quick grocery shopping done. I'll figure this out when I get home.
No comments:
Post a Comment