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?!?”
=> “You are a Dog”[/sourcecode]

Hello All,

This blog is designed to function as a sort of journal where i can document code snippets and stuff like that. If you have anything to say, don’t hold back!