Guest User

Untitled

a guest
Oct 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. # 第一段階(デフォルト)
  2. def sample(&sample_proc_4)
  3. puts sample_proc_4.call(2)
  4. end
  5.  
  6. sample { |n| n ** 5 } #=> 32
  7.  
  8. # 第二段階
  9. def sample(&sample_proc_4)
  10. puts yield(2)
  11. end
  12.  
  13. sample { |n| n ** 5 } #=> 32
  14.  
  15. # 第三段階
  16. def sample
  17. puts yield(2)
  18. end
  19.  
  20. sample { |n| n ** 5 } #=> 32
Add Comment
Please, Sign In to add comment