ruby single line if statement code example
Example 1: ruby if statement one line
if_condition ? if_statement : else_statement
Example 2: ruby shorthand if
today == ChristmasEve ? (puts "Santa's On His Way!") : (puts "Snow")
if_condition ? if_statement : else_statement
today == ChristmasEve ? (puts "Santa's On His Way!") : (puts "Snow")