Replace a specific element in an array?

Solved, was pretty simple in the end:

if(set array[index] = newelement){}

the curly brackets at the end are necessary