From: Elliot Temple Date: 2006-07-11T02:55:51+09:00 Subject: Re: Real newbie question about methods On Jul 10, 2006, at 10:40 AM, simonh wrote: > def check_age(age) > print "Please enter your age: " > age = gets.chomp.to_i > eligible = 18..30 > > if age < 18 > print "Sorry, too young." > elsif eligible === age > print "Have a great holiday!" > else > print "Input not understood." > check_age(age) # trying recursion here > end > check_age() > end you don't want recursion. def check_age(age) eligible = 18..30 if age < 18 print "Sorry, too young." elsif eligible === age print "Have a great holiday!" else print "Input not understood." end end print "Please enter your age: " age = gets.chomp.to_i check_age(age) -- Elliot Temple http://www.curi.us/blog/