For each an variables

For each an variables

If I try this kind of script:

employeerecords = Employee [Team == "Deluge"];
for each x in employeerecords
{
sendmail
(
To : x.Email
From : "hr@yourdomain.com"
Subject : "Important announcement"
Message : "Your message goes here"
)
}

I have a problem with 'x'.

If I do nothing, I get an error: "Variable x is not declared."

If I declare x by either creating a form field or by putting it in a script, I get an error message "Variable x is already declared".

This way I can not make this sample script working. What am I doing wrong??

Thanks for the response.

Martijn