Is it bad to check if an array is not empty by using any? method?

a = [1,2,3]

a.any?
=> true

a.clear

a.any?
=> false

Or is it better to use unless a.empty? ?

6 Answers
6

Tags:

Leave a Reply

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