Ruby | Matrix hash() function Last Updated : 14 Sep, 2021 Improve Improve Like Article Like Save Share Report The hash() is an inbuilt method in Ruby returns the hash-code of the matrix. Syntax: mat1.hash()Parameters: The function does not accepts any parameter.Return Value: It returns the hash-code of the matrix. Example 1: Ruby # Ruby program for hash() method in Matrix # Include matrix require "matrix" # Initializes the matrix mat1 = Matrix[[12, 21], [31, 12]] # Prints the hash-code puts mat1.hash() Output: 631900695216402634 Example 2: Ruby # Ruby program for hash() method in Matrix # Include matrix require "matrix" # Initializes the matrix mat1 = Matrix[[6, 7], [9, 10], [12, 4]] # Prints the hash-code puts mat1.hash() Output: -1308023948917233670] Like Article Suggest improvement Previous Ruby | Matrix identity() function Next Ruby | Time hash function Share your thoughts in the comments Add Your Comment Please Login to comment...