Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def a(meth)
- meth.call(5)
- end
- def b(x)
- x+3
- end
- a(method(:b)) #=> 8
- def c(sym)
- send(sym,5)
- end
- c(:b) #=> 8
- def d(prok)
- prok.call(5)
- end
- d(proc {|x| b(x)}) #=> 8
- def e
- yield 5
- end
- e {|x| b(x)} #=> 8
Add Comment
Please, Sign In to add comment