Skip to content
Related Articles

Related Articles

Improve Article

Ruby | Vector eql?() function

  • Last Updated : 07 Jan, 2020
Geek Week

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :