From: Bertram Scharpf Date: 2009-07-17T12:14:38+09:00 Subject: Re: case statement puzzle Hi, Am Freitag, 17. Jul 2009, 07:01:07 +0900 schrieb Tom Cloyd: > Bertram Scharpf wrote: >> To apply the === operator you have to mention the variable >> after the "case" keyword. >> >> x = '1' >> case x >> when '0' then puts '0' >> when '1'..'5' then puts '1' >> end >> > Thanks...you're right, of course, and I soon learned that, in this morning > ruby exercise session. Very interesting! Yes, learning is the only straight fun. Returning to your initial problem: Maybe it could be a reasonable solution to say if x.to_i.nonzero? then do_it_with x end As I mention Fixnum#nonzero?: Furthermore, I'm convinced there should be a corresponding String#notempty? method. And Array#notempty?. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de