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

Block and parameters

def run(number, &block)
  puts "before"
  yield number
  puts "after"
end

run(10) { |value|
  puts "in block #{value}"
}
puts "----"

run(20) do |value|
  puts "in do-end #{value}"
end