From: "David A. Black" Date: 2009-11-01T06:20:05+09:00 Subject: Re: how can i perform a one line case statement on a number Hi -- On Sun, 1 Nov 2009, Braxton Beyer wrote: > I want to be able to do something like this: > > 1000.case when 100 then "string1" when 110 then "string2" else "Unknown" > end > > I have an app that allows an admin to enter a filter that is ruby code. > The filter code is then applied directly to a variable. Is there a way > to apply a case statement such as the one above case isn't a method; it's a keyword, so you would do: case 1000 when 100 ... end I'm not sure I've grasped exactly what you need to do, though. David -- The Ruby training with D. Black, G. Brown, J.McAnally Compleat Jan 22-23, 2010, Tampa, FL Rubyist http://www.thecompleatrubyist.com David A. Black/Ruby Power and Light, LLC (http://www.rubypal.com)