Ruby | Vector zero?() function
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?() |
chevron_right
filter_none
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?() |
chevron_right
filter_none
Output:
false
Recommended Posts:
- Ruby | Vector zero() function
- Ruby | Vector eql?() function
- Ruby | Vector r() function
- Ruby | Vector independent? function
- Ruby | Vector covector() function
- Ruby | Vector component() function
- Ruby | Vector cross_product() function
- Ruby | Vector inner_product() function
- Ruby | Vector to_a() function
- Ruby | Vector normalize() function
- Ruby | Vector round() function
- Ruby | Vector angle_with() function
- Ruby | Vector size() function
- Ruby | Vector norm() function
- Ruby | Vector hash() 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.

