# Desert combat help : how to increment ordersGiven?

**URL:** https://discourse.codecombat.com/t/desert-combat-help-how-to-increment-ordersgiven/20208
**Category:** Level Help
**Created:** [February 7, 2020, 4:29am UTC](https://discourse.codecombat.com/t/desert-combat-help-how-to-increment-ordersgiven/20208 "2020-02-07T04:29:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![slime\_bunny\_222](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/slime_bunny_222/32/11390_2.png) [@slime\_bunny\_222](https://discourse.codecombat.com/u/slime_bunny_222)
#### Post date: [February 7, 2020, 4:29am UTC](https://discourse.codecombat.com/t/desert-combat-help-how-to-increment-ordersgiven/20208/1 "2020-02-07T04:29:10Z")

</div>

I am stuck in this level and I don’t know how to use the new /# Be sure to increment ordersGiven/.  
I hope you can help me to get out of this level.

_# while-loops repeat until the condition is false._  
ordersGiven = 0  
while ordersGiven \< 5:  
_# Move down 10 meters._  
ordersGiven += 1  
_# Order your ally to “Attack!” with hero.say_  
_# They can only hear you if you are on the X._  
hero.say(“Attack!”)

```
# Be sure to increment ordersGiven!

```

while True:  
enemy = hero.findNearestEnemy()  
# When you’re done giving orders, join the attack.  
if enemy:  
hero.attack(enemy)

---

<div class="post-metadata">

### Author: ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)
#### Post date: [February 7, 2020, 12:48pm UTC](https://discourse.codecombat.com/t/desert-combat-help-how-to-increment-ordersgiven/20208/2 "2020-02-07T12:48:42Z")

</div>

Welcome to the forum! Please format your code properly. You can learn how, here: [[Essentials] How To Post/Format Your Code Correctly](https://discourse.codecombat.com/t/essentials-how-to-post-format-your-code-correctly/15521)

That being said, to “increment” is to increase by 1 (or any value). Think of it as a counter. ‘ordersGiven’ is the counter in this case. Every time you give an order, you want to increase ‘ordersGiven’ by 1, or increment it…’+= 1’ is a method for doing this. Another method, which does exactly the same thing is:

ordersGiven = ordersGiven +1.

The ‘+= 1’ method is shorter (to type), but still does the adding of 1 to the counter.

---

<div class="post-metadata">

### Author: ![slime\_bunny\_222](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/slime_bunny_222/32/11390_2.png) [@slime\_bunny\_222](https://discourse.codecombat.com/u/slime_bunny_222)
#### Post date: [February 8, 2020, 6:37am UTC](https://discourse.codecombat.com/t/desert-combat-help-how-to-increment-ordersgiven/20208/3 "2020-02-08T06:37:00Z")

</div>

Ok, and thank you! I finished it by adding that block 🙂

---

<div class="post-metadata">

### Author: ![slime\_bunny\_222](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/slime_bunny_222/32/11390_2.png) [@slime\_bunny\_222](https://discourse.codecombat.com/u/slime_bunny_222)
#### Post date: [February 8, 2020, 7:12am UTC](https://discourse.codecombat.com/t/desert-combat-help-how-to-increment-ordersgiven/20208/4 "2020-02-08T07:12:20Z")

</div>

> [@dedreous](#):
>
> Please format your code properly.

I will format my code next time! I forgot to press \</\> that time ( sorry 😢 ) Thanks for reminding me

And finally this problem is solved!
