Lua Code Back to Back Help

I am getting the refrence error enemyis not defined.
This is my code.
– Stay in the middle and defend!

loop
enemy = self:findNearestEnemy()
if enemy then
– Either attack the enemy…
self:attack(enemy)
else
– … or move back to your defensive position.
self:attack(enemy)
end
end

Figured it out myself ha to say local didn’t have to before weird

In the future, please format your code according to the FAQ. It helps us better understand your code as we try to help. Basically, it helps us help you!

If you have trouble finding it, click here
https://discourse.codecombat.com/faq

Also, in the future, please give more information about what happens in the game when you run your code.