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?
To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.
https://crystal-lang.org/docs/syntax_and_semantics/unless.html