Ruby | Vector hash() function Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The hash() is an inbuilt method in Ruby returns hash code of the vector Syntax: vec1.hash() Parameters: The function accepts no parameter. Return Value: It returns hash code of the vector. Example 1: Ruby # 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() Output: -2830195808542644263 Example 2: Ruby # 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() Output: -3301760512247990187 Comment More infoAdvertise with us Next Article Ruby | Vector hash() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Vector-class Similar Reads Ruby | Vector r() function The r() is an inbuilt method in Ruby returns the Pythagorean distance of the vector. Syntax: vec1.r() Parameters: The function accepts no parameter Return Value: It Pythagorean distance of the vector Example 1: Ruby # Ruby program for r() method in Vector # Include matrix require "matrix" 1 min read Ruby | Hash to_s() function Hash#to_s() is a Hash class method which gives the string representation of hash. Syntax: Hash.to_s() Parameter: Hash values Return: string representation of hash Example #1 : Ruby # Ruby code for Hash.to_s() method # declaring Hash value a = {a:100, b:200} # declaring Hash value b = {a:100, c:300, 1 min read Ruby | Hash values function Hash#values() is a Hash class method which returns the values present in the hash. Syntax: Hash.values() Parameter: Hash values Return: hash values Example #1 : Ruby # Ruby code for Hash.values() method # declaring Hash value a = {a:100, b:200} # declaring Hash value b = {a:100, c:300, b:200} # decl 1 min read Ruby | Vector norm() function The norm() is an inbuilt method in Ruby returns the pythagorean distance of the vector. Syntax: vec1.norm() Parameters: The function accepts no parameter Return Value: It pythagorean distance of the vector Example 1: Ruby # Ruby program for norm() method in Vector # Include matrix require "matr 1 min read Ruby | Time hash function Time#hash() : hash() is a Time class method which returns the hash code for this Time object. Syntax: Time.hash() Parameter: Time values Return: the hash code for this Time object. Example #1 : Ruby # Ruby code for Time.hash() method # declaring time a = Time.new(2019) # declaring time b = Time.new( 2 min read Like