标签:
Proc 和 lambda 的共同点:
Proc 和 lambda 的区别:
nil
to any that are missing.)。def batman_ironman_proc
victor = Proc.new { return "Batman will win!" }
victor.call
"Iron Man will win!"
end
puts batman_ironman_proc
def batman_ironman_lambda
victor = lambda { return "Batman will win!" }
victor.call
"Iron Man will win!"
end
puts batman_ironman_lambda
输出结果====》Batman will win!
Iron Man will win!
标签:
原文地址:http://www.cnblogs.com/patientAndPersist/p/4378267.html