Ruby | Vector – method Last Updated : 20 Dec, 2021 Improve Improve Like Article Like Save Share Report The – is an inbuilt method in Ruby returns the subtraction of two vectors Syntax: vec1 – vec2Parameters: The function does not accepts any parameter.Return Value: It returns the subtraction two vectors. Example 1: CPP #Ruby program for - method in Vector #Include matrix require "matrix" #Initialize the vectors vec1 = Vector[1, 2] vec2 = Vector[1, 4] #prints the new vector puts vec1 - vec2 Output: Vector[0, -2] Example 2: CPP #Ruby program for - method in Vector #Include matrix require "matrix" #Initialize the vectors vec1 = [ 1, 4, 5 ] vec2 = [ 1, 4, 7 ] #prints the new vector puts vec1 - vec2 Output: Vector[0, 0, -2] Like Article Suggest improvement Previous Ruby | Vector norm() function Next Ruby | Vector + method Share your thoughts in the comments Add Your Comment Please Login to comment...