Mega Code Archive

 
Categories / Ruby / Array
 

Drop leading nils

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