From: David Masover Date: 2011-01-14T15:55:06+09:00 Subject: Re: random orc game On Thursday, January 13, 2011 11:59:56 pm Josh Cheek wrote: > On Thu, Jan 13, 2011 at 4:33 PM, Steve Rees wrote: > > Thankyou for taking the time to go through, that so thoroughly - that > > kind of feedback and pointers is really useful. > > I'll go through the file again and make all those changes, they make a > > lot of sense! > > Steve > > > > -- > > Posted via http://www.ruby-forum.com/. > > Another method you might write could be named "prompt", which just accepts > a string, prints it to the terminal, and returns the user's response. > Then, the many places you do things like: > puts 'The Orc\'s health is now ' + orchealth.to_s > gets > > could then become > prompt 'The Orc\'s health is now ' + orchealth.to_s Minor nitpick: It is generally faster to use interpolation than concatenation. This is especially true for more values than one, but even here, I don't think there's anything wrong with: prompt "The Orc's health is now #{orchealth}" Yeah, it'll even to_s for you.