Yield with parameters



examples/functions/yield_params.cr
def run
  puts "before"
  yield 42
  puts "after"
end

run { |value|
  puts "in block #{value}"
}
puts "----"

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

run {
  puts "in block"
}
puts "----"

run do
  puts "in do-end"
end

examples/functions/yield_both.cr
def foo
  puts "foo before"
  yield
  puts "foo after"
end

def bar
  puts "bar before"
  yield
  puts "bar after"
end

foo bar {
  puts "in block"
}

puts "----"

foo bar do
  puts "in do-end"
end