Nic Lin's Blog
Recent content on Nic Lin's Blog
马上订阅 Nic Lin's Blog RSS 更新: https://blog.niclin.tw/index.xml
Rails 的 scope 為什麼用 lambda? Proc 與 lambda 不同之處
2019年11月1日 18:23
lambda 和 Proc 幾乎一模一樣,主要差異,差在「檢查參數」和「丟回控制權」 打開 irb console 來試試看下面兩個 method def test_proc test = Proc.new { return "Return Successful" } test.call "Proc not return" end def test_lambda test = lambda { return "Return Successful" } test.call