Shorthand Using a Ternary Operator

This is great for writing short and poignant if-statements in Ruby and IMO makes code a bit more readable. The syntax of the ternary operator: [condition] ? [true expression] : [false expression] Example Usage: [sourcecode language=’ruby’]irb(main):182:0> animal = “Dog” => “Dog” irb(main):183:0> animal == “Dog” ? “You are a Dog” : “WHAT ARE YOU?!?” => […]