# Operation "Killdeer"

**URL:** <https://discourse.codecombat.com/t/operation-killdeer/18181>\
**Category:** Level Help\
**Created:** [April 17, 2019, 1:39pm UTC](https://discourse.codecombat.com/t/operation-killdeer/18181 "2019-04-17T13:39:47Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [April 17, 2019, 2:35pm UTC](https://discourse.codecombat.com/t/operation-killdeer/18181/4 "2019-04-17T14:35:43Z")

</div>

Your code works for me however there’s a couple of issues. First, avoid using global variables whenever you can. The enemy definition belongs in the while True loop. Second, you should always check for the existence of the enemy before doing anything like attacking. In this case you can do this by changing else to elif enemy.

---

_[View the full topic](https://discourse.codecombat.com/t/operation-killdeer/18181)._
