Q:

Explicit vs Implicit return

In the case below, the loop exits upon answering "yes" or "no".
def ask question
  while true
    puts question
    answer = gets.chomp.downcase

    if answer == "yes"
        return true
    elsif answer == "no"
        return false
    end
    puts "Please answer \"yes\" or \"no\"."
  end
end

ask('hello')

When the return statements next to the boolean values are removed, the last puts (please answer ...) is printed in the console, and the loop is then executed again.
A loop should break when anything is returned (either explicitly or implicitly) or when there is a break defined, correct? What's different when there is explicit returns in this case?

A:

A methods ends when one of the following occurs

Immediately when the thread terminates
Immediately when a raise/throw is encountered - excepting as such is handled
Immediately when a return is encountered
When it runs out of code or "reaches the end", in which case the value of the last expression is returned

The immediate forms end the method immediately (no surprise), while simple pure expressions such as true or false as appearing by themselves on a line by themselves (read: an expression) mean nothing unless such values are themselves used - but this is not done the return is removed.

