ReferenceError: variable is not defined - local variable within loop

Hi. This should help.