Ruby | Vector hash() function
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 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() |
chevron_right
filter_none
Output:
-2830195808542644263
Example 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() |
chevron_right
filter_none
Output:
-3301760512247990187
Recommended Posts:
- Ruby | Hash any?() function
- Ruby | Hash each() function
- Ruby | Hash key?() function
- Ruby | Hash key() function
- Ruby | Hash dig() function
- Ruby | Hash eql? function
- Ruby | Hash fetch_values() function
- Ruby | Hash rehash function
- Ruby | Hash fetch function
- Ruby | Hash inspect() function
- Ruby | Hash to_s() function
- Ruby | Hash invert() function
- Ruby | Hash include?() function
- Ruby | Hash values function
- Ruby | Hash keep_if() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



