From: Matthew Bloch Date: 2010-08-07T01:27:17+09:00 Subject: Re: Problem with return value On 06/08/2010 17:23, Amir Ebrahimifard wrote: > Hi > In this code : > ------------------------------- > > def test_method(name) > puts name > 3+5 > end > > > return_value = test_method("James") > puts return_value > ------------------------------- > > why when the last statement executed , "puts" does not return "nil" and > return 8? Because in Ruby, the last statement executed in a block is the block's value. That goes for your test_method's return value, and any other type of block you use. -- Matthew Bloch