From: Brian Candler Date: 2010-09-02T22:58:00+09:00 Subject: Re: New to ruby - Need help with simple guessing program Evan Riley wrote: > Can anyone help me with tracking the amount of entries he makes? Thank > you. Put these lines in the appropriate places: tries = 0 ... tries = tries + 1 ... puts "You took #{tries} attempt(s)" BTW your code could do with some trimming, but if it works that's the first thing :-) Some suggestions: * no need for inner while loops, the outer while loop handles it for you. if condition1 ... elsif condition2 ... else ... end * Move the bits which are common (prompting for the next attempt) to outside of this section, since they're the same in all cases -- Posted via http://www.ruby-forum.com/.