Todd Benson
5/3/2008 1:35:00 PM
On Sat, May 3, 2008 at 8:25 AM, Michael T. Richter <ttmrichter@gmail.com> wrote:
> irb(main):001:0> x = 6
> => 6
> irb(main):002:0> y = x == 5 ? 0 : 2
> => 2
> irb(main):003:0> x = 6
> => 6
> irb(main):004:0> y = if x == 5
> irb(main):005:1> 0
> irb(main):006:1> else
> irb(main):007:1* 2
> irb(main):008:1> end
> => 2
> irb(main):009:0>
Absolutely silly way if all things are constant (just for fun :) ...
irb(main):001:0> y = [0, 2][x % 5]
Todd