Ruby | Matrix row_size() function
The row_size() is an inbuilt method in Ruby returns the number of rows in the given matrix.
Syntax: mat1.row_size()
Parameters: The function does not takes any mandatory parameter.
Return Value: It returns the number of rows in the matrix.
Example 1:
require "matrix"
mat1 = Matrix[[ 6 , 432 ], [ 54 , 323 ]]
puts mat1.row_size()
|
Output:
2
Example 2:
require "matrix"
mat1 = Matrix[[ 1 , 1 , 1 ],[ 2 , 2 , 2 ],[ 3 , 5 , 6 ]]
puts mat1.row_size()
|
Output:
3
Last Updated :
07 Jan, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...