drop leading nils : drop_while « Array « Ruby






drop leading nils


[nil, 1, 2].drop_while {|x| !x }   # => [1,2]: drop leading nils

 

Related examples in the same category