until

An until executes its body until its condition is truthy. An until is just syntax sugar for a while with the condition negated:

  1. until some_condition
  2. do_this
  3. end
  4. # The above is the same as:
  5. while !some_condition
  6. do_this
  7. end

break and next can also be used inside an until, and like in while expressions, breaks may be used to return values from an until.