参考
https://qiita.com/kidach1/items/15cfee9ec66804c3afd2

# &でブロックを引数に
def exec_block(&block)
  block.call
end

exec_block do
  p "p_bloack"
end


####Proc
proc = Proc.new do
  p "proc_new"
end

proc.call

#### yield
def exec_block2(&block)
  yield
end

exec_block2 do
  p "block2"
end
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.