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) |
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) |
Output:
false