From: Matt Mongeau Date: 2013-03-02T03:38:58+09:00 Subject: Re: Why class returns `null` but the definition not when their description ended in IRB? --047d7b6041cad0b25504d6e15191 Content-Type: text/plain; charset=ISO-8859-1 Because that's how it is implemented. 2013/3/1 Kumar R. > The below class description returns its last evaluated expression : > > >> class A > >> 1+7 > >> 2+4 > >> end > => 6 > > To return `6` which method the expression generally called? > > But why the definition always `nil` ? > > >> def D > >> 3+5 > >> end > => nil > > -- > Posted via http://www.ruby-forum.com/. > > --047d7b6041cad0b25504d6e15191 Content-Type: text/html; charset=ISO-8859-1
Because that's how it is implemented.


2013/3/1 Kumar R. <lists@ruby-forum.com>
The below class description returns its last evaluated expression :

>> class A
>> 1+7
>> 2+4
>> end
=> 6

To return `6` which method the expression generally called?

But why the definition always `nil` ?

>> def D
>> 3+5
>> end
=> nil

--
Posted via http://www.ruby-forum.com/.


--047d7b6041cad0b25504d6e15191--