Bug: elif must be paired with an if

I am doing dueling grounds when I encountered this unexpected error. It says that elif must be paired with an if, but I have an if in the statement above.
Problematic part of code:

for friend in friends:
            if friend.distanceTo(enemyHero) < 20:
                if friend.pos.y > enemyHero.pos.y:
                    hero.command(friend, "move", Vector(friend.pos.x, enemyHero.pos.y+10)
                elif friend.pos.y < enemyHero.pos.y:<--- (Bug is in this line)
                    hero.command(friend, "move", Vector(friend.pos.x, enemyHero.pos.y-10)

Pls help, Thanks.

You’re missing an extra parenthesis at the end of the hero.command() function. So add one more ) to each of the command function calls.

1 Like

Thanks! I’ll try it!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.