I need to replace every element in an array by the multiplication pf the previous and the next element.

So far I got

def modif(array)

a = array

a[0] = array[0] * array[1]

l = array.length - 1

for i in (1…l)

a[i] = array[i-1] * array[i+1]

end

```
a[-1] = array[l] * array[-1]
a.reject(&:empty?)
puts "#{a}"
```

end

Where did I got it wrong?