重複の可能性:
Ruby の proc とラムダの違いは何ですか?
このRubyコードを実行すると:
def func_one
proc_new = Proc.new {return "123"}
proc_new.call
return "456"
end
def func_two
lambda_new = lambda {return "123"}
lambda_new.call
return "456"
end
puts "The result of running func_one is " + func_one
puts ""
puts "The result of running func_two is " + func_two
私が得る結果は次のとおりです。
The result of running func_one is 123
The result of running func_two is 456
については、最初の、つまりfunc_twoの値はどこにありますか? return123
ありがとう。