From: Doc O'Leary Date: 2010-07-12T02:35:07+09:00 Subject: Re: Basic Question: How do you check to see if gets is a number? In article , Adam Bourg wrote: > if ( age.to_f.to_s == true ) What do you expect this to evaluate to? Instead of "true", did you mean to use "age" (i.e., compare the original string with a reconverted number string)? Even that test will fail: irb(main):003:0> "42".to_f.to_s == "42" => false Barring full-blown input validation, the simple solution is to note that non-numbers get converted to 0. That also happens to be an age you can likely reject. Run with it. -- My personal UDP list: 127.0.0.1, localhost, googlegroups.com, astraweb.com, and probably your server, too.