I am trying to remove odd numbers from an array.

```
arr = [1, 2, 3, 4, 5, 6, 7, 8, 10]

def remove_odd_nums(arr)
  for x in arr
    if x % 2 == 0
      arr.delete(x)
    end
  end
end

print remove_odd_nums(arr)
# [1, 3, 5, 7, 10]

```

I can't seem to make this program work. The method works on the numbers except for the last one. What am I doing wrong?