Another, “straight from the docs post today.” Enumerable’s all? methods checks an entire collection for truthy.

%w[ant bear cat].all? { |word| word.length >= 3 } 
#=> true
 
%w[ant bear cat].all? { |word| word.length >= 4 } 
#=> false
 
[nil, true, 99].all?                              
#=> false

Leave a Reply

Your email address will not be published. Required fields are marked *