From: Eric Hodel Date: 2006-05-04T08:10:09+09:00 Subject: Re: Immediate if method On May 3, 2006, at 2:03 PM, Gregory Seidman wrote: > On Thu, May 04, 2006 at 05:59:22AM +0900, 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. > > cond ? if_true : if_false Also, result = if condition then true_value else false_value end Sprinkle with newlines to taste. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com