------art_6698_8429216.1192807361739
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 10/19/07, Tito Ciuro <tciuro / mac.com> wrote:
>
> Hello,
>
> I have a question about skipping the 'return' keyword in a Ruby method.
> For example:
>
> def self.encrypted_password(password, salt)
>   string_to_hash  assword + salt
>   Digest::SHA1.hexdigest(string_to_hash)
> end
>
> Being used to work in other languages, this is weird to me. Without
> looking at the documentation, I have no way of knowing that 'hexdigest'
> returns a string. Wouldn't the following be easier to understand?:
>
> def self.encrypted_password(password, salt)
>   string_to_hash  assword + salt
>   return Digest::SHA1.hexdigest(string_to_hash)
> end
>
> Why so many Ruby snippets skip the 'return' keyword?
>
> Thanks,
>
> -- Tito
> --
> Posted via http://www.ruby-forum.com/.
>
>
Because Ruby lets you be lazy like that.  You can put it in if you want but
you don't have to so laziness prevails.

However how does your adding return address your issue with not knowing what
the last method call returns?


-- 
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)

------art_6698_8429216.1192807361739--