Ruby Language unless


Example

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'
end