[Solved] I need help with decoy drill

this is my code it should work

We are field testing a new battle unit: the decoy.

Build 4 decoys, then report the total to Naria

decoysBuilt = 0
while True:
coin = hero.findNearestItem()
gold = hero.gold
if coin:
# Collect the coin!
hero.moveXY(coin.pos.x, coin.pos.y)

# Each decoy costs 25 gold.
# If hero.gold is greater than or equal to 25:
elif gold >= 25:
    # buildXY a "decoy"
    hero.buildXY("decoy", hero.pos.x, hero.pos.y)
    # Add 1 to the decoysBuilt count.
    decoysBuilt += 1
if decoysBuilt == 4:
    # Break out of the loop when you have built 4.
    break
    pass

hero.say(“Done building decoys!”)
hero.moveXY(14, 36)

Say how many decoys you built.

hero.say(decoysBuilt)

Supposing your formatting is right ( correct your post ) you have this piece of code:

decoysBuilt = 0
while True:
    coin = hero.findNearestItem()
    gold = hero.gold
    if coin:
        hero.moveXY(coin.pos.x, coin.pos.y)
    elif gold >= 25:
    # some more code that will never execute if you have too many coins

Change this elif to …
/ I really don’t like the structure of the default code:

    if condition1:
        action1
    if condition2:
        action2
    if condition3:
        action3  

/

i figured it out solved