one line if else ruby 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")