Ruby | Matrix empty?() function Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The empty?() is an inbuilt method in Ruby returns a boolean value. It returns true if the matrix is empty, else it returns false. Syntax: mat1.empty?() Parameters: The function does not accepts any parameter. Return Value: It returns a boolean value. Example 1: Ruby # Ruby program for empty() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[[1, 21], [31, 18]] # prints if empty or not puts mat1.empty?() Output: false Example 2: Ruby # Ruby program for empty() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[] # prints if empty or not puts mat1.empty?() Output: true Comment More infoAdvertise with us Next Article Ruby | Matrix element() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix element() function The element() is an inbuilt method in Ruby returns the element present at the intersection of i-th row and j-th column. Syntax: mat1.element(i, j) Parameters: The function accepts two parameters i and j which signifies the row_number and column_number. Return Value: It returns the element at mat[i][ 1 min read Ruby | Matrix element() function The element() is an inbuilt method in Ruby returns the element present at the intersection of i-th row and j-th column. Syntax: mat1.element(i, j) Parameters: The function accepts two parameters i and j which signifies the row_number and column_number. Return Value: It returns the element at mat[i][ 1 min read Ruby | Matrix eql? function The eql? is an inbuilt method in Ruby returns a boolean value. It returns true if both the matrix are equal or else it returns false.. Syntax: mat1.eql?(mat2)Parameters: The function need two matrix mat1 and mat2 which are to be compared.Return Value: It returns true if both the matrix are equal or 1 min read Ruby | Matrix eql? function The eql? is an inbuilt method in Ruby returns a boolean value. It returns true if both the matrix are equal or else it returns false.. Syntax: mat1.eql?(mat2)Parameters: The function need two matrix mat1 and mat2 which are to be compared.Return Value: It returns true if both the matrix are equal or 1 min read Ruby | Hash empty? function Hash#empty?() is a Hash class method which checks whether the Hash array has any key-value pair. Syntax: Hash.empty?()Parameter: Hash valuesReturn: true - if no key value pair otherwise return false Example #1 :  Ruby # Ruby code for Hash.empty?() method # declaring Hash value a = {a:100, b:200} # 1 min read Ruby | Matrix column() function The column() is an inbuilt method in Ruby returns a vector that has all the elements in the column number col_num. Syntax: mat1.column(col_num) Parameters: The function accepts a parameter col_num which is the column number. Return Value: It returns a vector which has all the elements of column col_ 1 min read Like