ruby array how to check if value empty 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