arr = [-3, -2, -1, 0, 1, 2, 3, -100, -200] new_arr = arr.take_while {|x| x <= 0} p new_arr # => [-3, -2, -1, 0]