Looking for ruby Answers? Try Ask4KnowledgeBase
Looking for ruby Keywords? Try Ask4Keywords

Ruby Language unless


A common statement is if !(some condition). Ruby offers the alternative of the unless statement.

The structure is exactly the same as an if statement, except the condition is negative. Also, the unless statement does not support elsif, but it does support else:

# Prints not inclusive
unless 'hellow'.include?('all')
  puts 'not inclusive'