From: Stefano Crocco Date: 2011-02-10T23:19:42+09:00 Subject: Re: Ruby ternary operator On Thursday 10 February 2011 23:12:06 Sam T. wrote: > If I do the following: > > value="off" > p value == "on" ? "YES" : "NO" > p value > > Then I get the > > >> "NO", "off" > > Does anyone know how I assign the result of the statement to a variable. > e.g the result of: > > value="off" > value == "on" ? "YES" : "NO" > > >> "NO" Have you tried a simple assignment? value="off" other_value = value == "on" ? "YES" : "NO" puts other_value => "NO" Stefano