I cant seem to figure out whats wrong, i tried other peoples code by adding it in but I cant find the issue

var coinAmount = 0;

if (hero.gold >= 20) {

while (coinAmount < 20); {

coin = hero.findItems();

coins = hero.findNearest(coin);

hero.moveXY(coins.pos.x, coins.pos.y);

if (coins.value == 1)

coinAmount += 1;

if (coins.value == 2)

coinAmount += 2;

if (coins.value == 3)

coinAmount +=3;

}

while (coinAmount >= 20);{

towers = hero.findByType(“arrow-tower”);

tower = hero.findNearest(towers);

hero.moveXY(tower.pos.x +6, tower.pos.y);

coinAmount -= 20;

hero.moveXY(hero.pos.x +2, hero.pos.y);

}

}

# Help with Sarven Siege (JavaScript)

**Expo17**#1

**FlowerChi**#2

Here is your code with corrections

you are coding this in Python right?

```
var coinAmount = 0
#You don't need a ";" at the end for python.
if hero.gold >= 20:
# "()" aren't needed after the if
while coinAmount < 20:
coin = hero.finditems()
coins = hero.findNearest(coin):
# you use ":" at the end not ";"
hero.moveXY(coins.pos.x, coin.pos.y)
if coins.value == 1:
coinAmount +=1
if coins.value == 2:
coinAmount += 2
if coins.value == 3:
coinAmount += 3
# in python it's all about indentation so no braces are needed so the end has none
while (coinAmount >= 20):
towers = hero.findByType("arrow-tower")
tower = hero.findNearest("towers")
hero.moveXY(tower.pos.x + 6, tower.pos.y)
coinAmount -= 20;
hero.moveXY(hero.pos.x +2, hero,pos.y)
```

You don’t need the coinAmount variable because the program already made you one called “hero.gold” and I think you need a loop as well

```
#You can just do this
loop:
#here is the loop that you forgot
while hero.gold >= 20:
towers = hero.findByType("arrow-tower")
tower = hero.findNearest(towers)
hero.moveXY(tower.pos.x + 6, tower.pos.y)
hero.moveXY(hero.pos.x+ 2, hero.pos.y)
```