Mega Code Archive
Categories
/
Ruby
/
Array
Take until nil
[1,2,3,nil,4].take_while {|x| x } # => [1,2,3]: take until nil