From: jake kaiden Newsgroups: comp.lang.ruby Subject: Re: Understanding the return method Date: Sat, 16 Apr 2011 18:35:13 -0500 Organization: Service de news de lacave.net Lines: 26 Message-ID: <76b9507cbd1e9b454860e51c06f9affe@ruby-forum.com> References: <4aa6da7c8d4c99589c8a48a80c677218@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1302996930 20102 65.111.164.187 (16 Apr 2011 23:35:30 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Sat, 16 Apr 2011 23:35:30 +0000 (UTC) In-Reply-To: <4aa6da7c8d4c99589c8a48a80c677218@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381732 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <76b9507cbd1e9b454860e51c06f9affe@ruby-forum.com> Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!talisker.lacave.net!lacave.net!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:3041 hi fily - while i was answering your post, vincent answered it much better than i ever could have. the one thing that i would point out, is that it is important to remember that by default ruby returns the LAST statement evaluated (this can bite you in the arse if you forget!) the example you gave could also be written like this (without 'return'): def multiply(val1, val2 ) val1 * val2 end value = multiply( 10, 20 ) puts value #=>200 -j -- Posted via http://www.ruby-forum.com/.