Last Updated: February 25, 2016
·
339
· leifg

How to correctly check for filled array

Do you know the opposite of empty?

arr = ['array', 'with', 'stuff', 'in', 'it']

instead of

unless arr.empty?
  # do stuff
end

use

if arr.any?
  # do stuff
end

Check out the gist for details