Path: csiph.com!goblin2!goblin.stu.neva.ru!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail From: jacki Newsgroups: comp.lang.ruby Subject: Re: Using functions to return something Date: Wed, 20 Apr 2016 10:30:20 +0200 Organization: ATMAN - ATM S.A. Lines: 24 Message-ID: <57173E1C.2050905@idealan.pl> References: <69f480e7-0d0b-4fc7-bd69-49fc2f6540c4@googlegroups.com> NNTP-Posting-Host: biuro.idealan.pl Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: node2.news.atman.pl 1461141015 12668 178.212.148.2 (20 Apr 2016 08:30:15 GMT) X-Complaints-To: usenet@atman.pl NNTP-Posting-Date: Wed, 20 Apr 2016 08:30:15 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 To: Cai Gengyang In-Reply-To: <69f480e7-0d0b-4fc7-bd69-49fc2f6540c4@googlegroups.com> Xref: csiph.com comp.lang.ruby:7237 W dniu 2016-04-20 o 07:28, Cai Gengyang pisze: > > This is what I did : > > I created a file , defined a new variable c and saved it as ex50.rb --- > > def add(a, b, c) a, b and c - three arguments > > age = add(30, 10) / 5 > then you are calling function with two arguments and divide what function returns by 5 - really? And remember, that 7/3 = 2 not 2.333(3) because: 2.2.0 :005 > 7.class => Fixnum and Fixnum / Fixnum = Fixnum