Your specific error message relates to the fact you also have a variable called delay as well.

If you really have a delay () function, you need to rename your variable.