Ruby | Vector eql?() function
The eql?() is an inbuilt method in Ruby returns boolean value true if two vectors are same otherwise false
Syntax: vec1.eql?(vec2)
Parameters: The function accepts a single vector as parameters
Return Value: It returns boolean value true if two vectors are same otherwise false
Example 1:
# Ruby program for eql?() method in Vector # Include matrix require "matrix" # Initialize the vector vec1 = Vector[1, 2, 3] vec2 = Vector[1, 2, 3] # Checks if two vectors are same or not puts vec1.eql?(vec2) |
chevron_right
filter_none
Output:
true
Example 2:
# Ruby program for eql?() method in Vector # Include matrix require "matrix" # Initialize the vector vec1 = Vector[1, 2, 3] vec2 = Vector[1, 1, 3] # Checks if two vectors are same or not puts vec1.eql?(vec2) |
chevron_right
filter_none
Output:
false
Recommended Posts:
- Ruby | Vector r() function
- Ruby | Vector zero() function
- Ruby | Vector zero?() function
- Ruby | Vector elements() function
- Ruby | Vector norm() function
- Ruby | Vector hash() function
- Ruby | Vector angle_with() function
- Ruby | Vector component() function
- Ruby | Vector normalize() function
- Ruby | Vector inner_product() function
- Ruby | Vector covector() function
- Ruby | Vector independent? function
- Ruby | Vector to_a() function
- Ruby | Vector size() function
- Ruby | Vector round() 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.



