ruby check for nil or empty array code example
Example: test if array empty ruby
irb(main):001:0> [].length
=> 0
irb(main):002:0> [1].length
=> 1
irb(main):003:0> [1, 'foo'].length
=> 2
irb(main):001:0> [].length
=> 0
irb(main):002:0> [1].length
=> 1
irb(main):003:0> [1, 'foo'].length
=> 2