# Mad Maxer strikes back - type error

**URL:** <https://discourse.codecombat.com/t/mad-maxer-strikes-back-type-error/14987>\
**Category:** Uncategorized\
**Created:** [June 15, 2018, 9:11pm UTC](https://discourse.codecombat.com/t/mad-maxer-strikes-back-type-error/14987 "2018-06-15T21:11:18Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![xython](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xython/32/7269_2.png) [@xython](https://discourse.codecombat.com/u/xython)\
**Post date:** [June 16, 2018, 12:02am UTC](https://discourse.codecombat.com/t/mad-maxer-strikes-back-type-error/14987/5 "2018-06-16T00:02:48Z")

</div>

You have

```python
    while enemies: #THIS IS THE LINE THAT'S NOT WORKING
        # someAction        
        enemyIndex += 1

```

vs

```python
    while enemyIndex < len(enemies):
        # someAction        
        enemyIndex += 1

```

How do you exit from the first loop? The message is confusing but shows the the error.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/3/3d6cc2916629e03689f0737afc7e64548100082f.png)

The message must be something like **IndexError**.  
[http://www.pythontutor.com](https://goo.gl/5Niqsz)

---

_[View the full topic](https://discourse.codecombat.com/t/mad-maxer-strikes-back-type-error/14987)._
