From: Tito Ciuro Date: 2007-10-20T01:01:10+09:00 Subject: Re: Is it always the norm to skip 'return'? --Apple-Mail-5--245897204 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Sebastian, On Oct 19, 2007, at 8:54 AM, Sebastian Hungerecker wrote: > Tito Ciuro wrote: >>>> def self.encrypted_password(password, salt) >>>> string_to_hash = password + salt >>>> return Digest::SHA1.hexdigest(string_to_hash) >>>> end >>>> >> Well, if I'm looking at some code with a return statement as shown >> above, I tells me that Digest::SHA1.hexdigest returns a string > > Where does it tell you that? I don't get it. hexdigest could return > anything, > you can't know it returns a string just by the fact that there's a > return in > front of it. You can only tell that by looking at it's documentation. > What does the return keyword have to do with what kind of object a > method > returns? That's not what I meant. You're right, the return keyword has nothing to do with the return type. What I meant is that without the return, to me it looks like a one-way method. If I see a 'return', I know there is something being returned. To me, and possibly other people as well, the inclusion of 'return' would make things clearer. That's all :-) Thanks, -- Tito --Apple-Mail-5--245897204--