# \[Solved\] "Fix code" Explanation is Confusing

**URL:** <https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438>\
**Category:** Uncategorized\
**Created:** [January 4, 2018, 9:57pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438 "2018-01-04T21:57:43Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdc4491](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@sdc4491](https://discourse.codecombat.com/u/sdc4491)\
**Post date:** [January 4, 2018, 9:57pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/1 "2018-01-04T21:57:43Z")

</div>

Maybe because I’m inexperienced with code lingo but I can’t understand what it’s saying…maybe actually using complete sentences in an explanation to someone who is learning would make sense…doesn’t do that though…just seems like gibberish, but also as many times as I looked at the example and copied exactly, the code does not work. Something’s off and there’s just not any decent explanation from the game as to why.

Level is Mayhem of Munchkins and here’s what I have:

# Inside a while-true loop, use findNearestEnemy() and attack!

while True:  
e = hero.findNearestEnemy  
hero.attack(e)

```
hero.moveDown()

```

Fix code explanation just says:  
Line 4: attack’s argument target should have type unit, but got function. Target a Unit.

[Please don’t swear]!?!?  
stupid…

---

<div class="post-metadata">

**Author:** ![sdc4491](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@sdc4491](https://discourse.codecombat.com/u/sdc4491)\
**Post date:** [January 4, 2018, 10:04pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/2 "2018-01-04T22:04:33Z")

</div>

Figured it out and it wasn’t even the line that the fix code explanation was saying was the problem…it was because I didn’t have an empty parenthesis next to findNearestEnemy…pretty frustrating

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [January 4, 2018, 11:03pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/3 "2018-01-04T23:03:58Z")

</div>

1. No cursing (read community guidelines)
2. Post your code in a legible manner. dont just paste it directly (read FAQ)
3. “Frustrating” Seriously. Look at the number of worlds after dungeon. It will get unbearable if you think it’s frustrating right now. (sorry for pep talks)
4. I’m gonna fix the title of this post, and mark it solved

---

<div class="post-metadata">

**Author:** ![sdc4491](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@sdc4491](https://discourse.codecombat.com/u/sdc4491)\
**Post date:** [January 4, 2018, 11:35pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/4 "2018-01-04T23:35:19Z")

</div>

1. Didn’t cuss. F is a letter, but I’ll refrain from such abbreviations the future.

2. My bad on that one. I did just paste it from the game.

3. The fix code explanation not being legible was what was frustrating, I can handle repetitive problem solving for a very long time, but being given an extremely poorly written explanation as to what I’m doing wrong, not even using complete sentences frustrates me and on top of that…the problem it was stating didn’t exist…it was telling me the wrong problem on the wrong line. I had to find it out for myself by finally just ignoring what the thing was saying and looking elsewhere. The fix code explanation was actually the problem itself and the reason I couldn’t figure it out in the first place.

4. Okay, thanks.

---

<div class="post-metadata">

**Author:** ![kyay10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kyay10/32/7337_2.png) [@kyay10](https://discourse.codecombat.com/u/kyay10)\
**Post date:** [January 5, 2018, 2:24am UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/5 "2018-01-05T02:24:34Z")

</div>

> [@sdc4491](#):
>
> The fix code explanation not being legible was what was frustrating, I can handle repetitive problem solving for a very long time, but being given an extremely poorly written explanation as to what I’m doing wrong, not even using complete sentences frustrates me and on top of that…the problem it was stating didn’t exist…it was telling me the wrong problem on the wrong line. I had to find it out for myself by finally just ignoring what the thing was saying and looking elsewhere. The fix code explanation was actually the problem itself and the reason I couldn’t figure it out in the first place.

the problem exists,the fix code explanation was actually right, it is just you didn’t understand it, because it is a little bit advanced, the explanation is saying that you passed a function-type variable to attack, which is what you did, when you write only hero.findNearestEnemy without parenthesis, you are referring to the function named findNearestEnemy, not its result or the something that it returns, and it didn’t give you an error in line 3 because you can actually store functions into variables, but it gave you an error on line 4 because you need a unit-type variable, not a function-type variable

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [January 5, 2018, 5:08am UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/6 "2018-01-05T05:08:42Z")

</div>

Functions have to have parentheses too, i think.  
cuz when u define or use a function, u have to use parentheses.  
ex:

```python
def ActionWhenBored():
    hero.say("I'm bored.")
    hero.say("ZZzZZZZZZZZzzzzzZZzzzzZZZZzzz")
ActionWhenBored()

```

---

<div class="post-metadata">

**Author:** ![Aiden\_Williams](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aiden_williams/32/10819_2.png) [@Aiden\_Williams](https://discourse.codecombat.com/u/Aiden_Williams)\
**Post date:** [October 2, 2019, 6:34pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/7 "2019-10-02T18:34:33Z")

</div>

![18%20PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/9/9a22e16e6bfe14d95bd036b26cf06dfa31226b27.jpeg) why isn’t this working

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [October 2, 2019, 6:54pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/8 "2019-10-02T18:54:28Z")

</div>

Hi Aiden. Welcome to Discourse!

The directions:

```python
# Write the attachEnemy function below.
# Find the nearest enemy and attack them if they exist.

```

Compare what you have written to the `pickUpCoin()` function. The function you need to write should look exactly like the `pickUpCoin()` function, except your function will be called, `attackEnemy()` and “coin” will be replaced with “enemy” (without the quotes) and the variable definition with use the, `hero.findNearestEnemy()` method and you will attack the enemy instead of moving to its position. Your function will even have the exact same number of lines and then you will call this function in the `while True:` loop, the exact same way the default code calls the `pickUpCoin()` function.

---

<div class="post-metadata">

**Author:** ![Justice\_Nelson](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/justice_nelson/32/37716_2.png) [@Justice\_Nelson](https://discourse.codecombat.com/u/Justice_Nelson)\
**Post date:** [March 4, 2024, 10:04pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/9 "2024-03-04T22:04:21Z")

</div>

But if it say something and its not wrong how do you know?

---

<div class="post-metadata">

**Author:** ![porter119](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/porter119/32/36770_2.png) [@porter119](https://discourse.codecombat.com/u/porter119)\
**Post date:** [March 4, 2024, 11:11pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/10 "2024-03-04T23:11:12Z")

</div>

Hi @Justice_Nelson welcome to the discourse! this is a place where you can ask for help on codecombat, chat, etc.! As for the problem, it just won’t say anything. And please don’t revive dead topics, it is annoying to the people who posted before, but you are a new user and did not know, so you are fine. Enjoy your time on the discourse!

---

<div class="post-metadata">

**Author:** ![Watamelon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/watamelon/32/43741_2.png) [@Watamelon](https://discourse.codecombat.com/u/Watamelon)\
**Post date:** [March 5, 2024, 5:44am UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/11 "2024-03-05T05:44:20Z")

</div>

Hi @Justice_Nelson, welcome to Discourse!

**Discourse** is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more!

**Discourse** is more than just a forum—it’s a platform for meaningful connections and thoughtful discussions. Whether you’re looking to create a community, host a discussion forum, or facilitate long-form chat rooms, Discourse has you covered.

With features designed to enhance engagement and foster collaboration, Discourse is the ideal solution for businesses, organizations, and communities alike. From tracking product feedback to sharing your latest creations, Discourse offers the tools you need to connect with your audience in a meaningful way.

And now, with the added support of AI, Discourse is more powerful than ever. AI-powered features enable you to streamline moderation, analyze user behavior, and personalize the user experience, making Discourse the ultimate platform for community engagement.

**Pricing:**

- **Basic Plan:** $50/month
- **Standard Plan:** $100/month
- **Enterprise Plan:** $300/month

Ready to take your community to the next level? Sign up for Discourse today and join the thousands of organizations already using Discourse to foster meaningful connections and drive engagement.

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

---

<div class="post-metadata">

**Author:** ![twofoursixeight](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/twofoursixeight/32/45818_2.png) [@twofoursixeight](https://discourse.codecombat.com/u/twofoursixeight)\
**Post date:** [March 5, 2024, 6:55pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/12 "2024-03-05T18:55:04Z")

</div>

> [@Watamelon](#):
>
> With features designed to enhance engagement and foster collaboration, Discourse is the ideal solution for businesses, organizations, and communities alike. From tracking product feedback to sharing your latest creations, Discourse offers the tools you need to connect with your audience in a meaningful way.
> 
> And now, with the added support of AI, Discourse is more powerful than ever. AI-powered features enable you to streamline moderation, analyze user behavior, and personalize the user experience, making Discourse the ultimate platform for community engagement.
> 
> **Pricing:**
> 
> - **Basic Plan:** $50/month
> - **Standard Plan:** $100/month
> - **Enterprise Plan:** $300/month
> 
> Ready to take your community to the next level? Sign up for Discourse today and join the thousands of organizations already using Discourse to foster meaningful connections and drive engagement.
> 
> ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/f/e/fe9b4e0855bc2ac96cfee114b09616250f0a4f81.png)

I’m confused on why the pricing is shown because people aren’t gonna buy a discourse forum for themselves usually, they are there for help on codecombat and stuff. Just curious, that’s all

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [March 5, 2024, 7:50pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/13 "2024-03-05T19:50:15Z")

</div>

thats not a good intro to the discourse that is a advertisement for discource

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [March 5, 2024, 7:51pm UTC](https://discourse.codecombat.com/t/solved-fix-code-explanation-is-confusing/13438/14 "2024-03-05T19:51:00Z")

</div>

hes trying to be funny but since this is new user it is a bad introduction
