Open In App

Ruby | Vector eql?() function

Last Updated : 07 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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
# 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
# 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

Next Article

Similar Reads