For objects that include Enumerable (Hash, Array and Range), there are these methods that are useful
All these methods takes a blog.
1. #all?
iterate through all the element, will return true if only ALL of the block statement return truthy value.
2. #any?
iterate through all the element, will return true if ANY of the block statement return truthy value.
3. #none?
iterate through all the element , will return true if NONE of the block statement return truthy value.
4. #one?
iterate through all the element , will return true if exactly one of the block statement return truthy value.
All these methods takes a blog.
1. #all?
iterate through all the element, will return true if only ALL of the block statement return truthy value.
2. #any?
iterate through all the element, will return true if ANY of the block statement return truthy value.
3. #none?
iterate through all the element , will return true if NONE of the block statement return truthy value.
4. #one?
iterate through all the element , will return true if exactly one of the block statement return truthy value.
Comments
Post a Comment