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 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?() |
chevron_right
filter_none
Output:
false
Example 2:
# Ruby program for empty() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[] # prints if empty or not puts mat1.empty?() |
chevron_right
filter_none
Output:
true
Recommended Posts:
- Ruby | Queue empty? function
- Ruby | SizedQueue empty? function
- Ruby | Hash empty? function
- Ruby | Set empty?() function
- Ruby | StringScanner empty? function
- Ruby | Symbol empty? function
- Ruby | Array class empty?() operation
- Ruby | String empty? Method
- Ruby | Matrix cofactor() function
- Ruby | Matrix singular?() function
- Ruby | Matrix eql? function
- Ruby | Matrix conjugate() function
- Ruby | Matrix symmetric?() function
- Ruby | Matrix clone() function
- Ruby | Matrix cofactor_expansion() function
- Ruby | Matrix collect() function
- Ruby | Matrix column_count() function
- Ruby | Matrix column() function
- Ruby | Matrix column_size() function
- Ruby | Matrix column_vectors() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

