Mega Code Archive

 
Categories / Ruby / Language Basics
 

Using the Ternary Operator

# result = condition ? true_value : false_value toppings = 4 price = toppings > 3 ? 5.99 : 4.99