The unless statement is an unique statement available in Ruby. When the supplied condition is false, this statement is executed. It's the inverse of an if statement.
The word "if" is conditional, as you presumably already know. It's used to explain a potential situation and what might happen in such situation. "Unless" is conditional as well, but it's effectively "if" with an additional exclusion or negative qualifier. Unless is a phrase that implies "except if" or "if... not."
Share a personalized message with your friends.