A simple if statement normally written.
if dishes_dirty == true
puts "wash the dishes"
The same code can be written on one line by first putting the output you want to return than condition after the if statement.
puts "wash the dishes" if dishes_dirty == true
If statements in ruby check if condition is true without explicit comparison since the statement is just a true or false boolean we can rewrite this code.
puts "wash the dishes" if dishes_dirty
IF Else Statement
The normal way you would write a normal if else statement is.
if hungry == true
puts "Go eat"
puts "Take a nap."
IF Else Ternary operator
hungry == true ? puts "Go eat" : puts "Take a nap."
The way this code works
condition ? condition meet output :else if condition not meet output