Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 433 Bytes

unless.md

File metadata and controls

21 lines (17 loc) · 433 Bytes

unless

An unless evaluates the then branch if its condition is falsey, and evaluates the else branch, if there’s any, otherwise. That is, it behaves in the opposite way of an if:

unless some_condition
  then_expression
else
  else_expression
end

# The above is the same as:
if some_condition
  else_expression
else
  then_expression
end

# Can also be written as a suffix
close_door unless door_closed?