From: David Pollak Date: 2006-05-04T06:04:34+09:00 Subject: Re: Immediate if method ------=_Part_52564_21126254.1146690270207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline true ? 'true' : 'what\' going on?' On 5/3/06, Jamal Mazrui wrote: > > Does Ruby have a built-in equivalent of what some other languages call > an "immediate if" function? I want to conditionally return one of two > strings on the status bar of an application, depending on whether a > variable is true or false. > > So far, I have written the module method below, but I'm guessing there > is a more efficient and elegant way with Ruby. > > Jamal > > def if_string(condition, if_true, if_false) > if condition > return if_true > else > return if_false > end > end > > > -- -------- David Pollak's Ruby Playground http://dppruby.com ------=_Part_52564_21126254.1146690270207--