# Ruby program for hash() method in Vector# Include matrix require"matrix"# Initialize the vector
vec1 =Vector[1,2,3]# Prints hash code of the vector
puts vec1.hash()
Ruby
输出:
-2830195808542644263
Ruby
例2 :
# Ruby program for hash() method in Vector# Include matrix require"matrix"# Initialize the vector
vec1 =Vector[1,1,1]# Prints hash code of the vector
puts vec1.hash()