Ruby | Vector zero?() function Last Updated : 07 Jan, 2020 Improve Improve Like Article Like Save Share Report The zero?() is an inbuilt method in Ruby returns boolean value true if all elements of vector are equals to zero otherwise false Syntax: vec1.zero?() Parameters: The function accepts no parameter Return Value: It returns boolean value true if all elements of vector are equals to zero otherwise false Example 1: # Ruby program for zero?() method in Vector # Include matrix require "matrix" # Initialize the vector vec1 = Vector[0, 0, 0] # Prints boolean value puts vec1.zero?() Output: true Example 2: # Ruby program for zero?() method in Vector # Include matrix require "matrix" # Initialize the vector vec1 = Vector[0, 1, 3] # Prints boolean value puts vec1.zero?() Output: false Like Article Suggest improvement Previous Ruby | Vector norm() function Next Ruby | Date amjd() function Share your thoughts in the comments Add Your Comment Please Login to comment...