Ruby | Matrix empty?() function Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share 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 empty?() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix det() function The det() is an inbuilt method in Ruby returns the determinant of the given matrix Syntax: mat1.det() Parameters: The function does not accepts any parameter. Return Value: It returns the determinant of the given matrix. Example 1: Ruby # Ruby program for det() method in Matrix # Include matrix requ 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 component() function The component() is an inbuilt method in Ruby returns the element present at the intersection of i-th row and j-th column. Syntax: mat1.component(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 1 min read Ruby | Matrix collect() function The collect() is an inbuilt method in Ruby returns the new matrix after performing the operation that is given in the block. Syntax: mat1.collect{|el| operation} Parameters: The function has the parameter as a block which is the operation which is performed on all elements. Return Value: It returns 1 min read Like