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 = password + 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 = password + 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/.