Prev: Basic Question: How do you check to see if gets is a number?
Next: How to pass a hash as a param to a method called through eval?
From: Adam Bourg on 11 Jul 2010 15:38 Thanks Stefano. It has been a major help. Also, thank you to others who've responded. Stefano Crocco wrote: > age_numeric = begin Integer(age) > rescue ArgumentError > puts "Enter a valid number" > exit > end > #months is already an integer, so there's no need to call to_i on it > monthsold = age_numeric * months > > I hope this helps > > Stefano -- Posted via http://www.ruby-forum.com/. |