Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sequence

def seq
  val = 0
  loop do
    val += 1
    yield val
  end
end

seq { |num|
  puts num
  break if num > 10
}
puts "after"