# Why is hero.say(enemies) not possible?

**URL:** <https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567>\
**Category:** Uncategorized\
**Created:** [November 7, 2016, 7:25pm UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567 "2016-11-07T19:25:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![juraj\_pechac](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/juraj_pechac/32/4987_2.png) [@juraj\_pechac](https://discourse.codecombat.com/u/juraj_pechac)\
**Post date:** [November 7, 2016, 7:25pm UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/1 "2016-11-07T19:25:10Z")

</div>

enemies = hero.findEnemies()  
hero.say(enemies)

What is this Error:Attempted to invoke bookmark for [Function]?

---

<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:** [November 7, 2016, 11:40pm UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/2 "2016-11-07T23:40:15Z")

</div>

I believe it’s because the method hero.say was expecting a string or a function. Normally, the word, enemies, would be in quotation marks like this:

```python
hero.say("enemies")

```

in which case the character would literally say the word, “enemies”.

Since it is not in quotation marks, the code was expecting a function to be called, only you haven’t defined a function called enemies.

```python
def enemies():
    # tab over and code goes here

```

Someone please correct me if I’m wrong about this.

---

<div class="post-metadata">

**Author:** ![juraj\_pechac](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/juraj_pechac/32/4987_2.png) [@juraj\_pechac](https://discourse.codecombat.com/u/juraj_pechac)\
**Post date:** [November 7, 2016, 11:49pm UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/3 "2016-11-07T23:49:22Z")

</div>

```python
def enemies():
        hero.say("Programming with Yeti")
hero.say(enemies) #[Function enemies]

```

I believe the method hero.say expect a string or a **variable**.

---

<div class="post-metadata">

**Author:** ![kavacha](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kavacha/32/5029_2.png) [@kavacha](https://discourse.codecombat.com/u/kavacha)\
**Post date:** [November 8, 2016, 1:32am UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/4 "2016-11-08T01:32:53Z")

</div>

The hero.say function expects string or number as the input, while “enemies” is an array. You’ll have to iterate through the array if you want the hero to say each of the enemy’s id.

---

<div class="post-metadata">

**Author:** ![juraj\_pechac](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/juraj_pechac/32/4987_2.png) [@juraj\_pechac](https://discourse.codecombat.com/u/juraj_pechac)\
**Post date:** [November 8, 2016, 5:43am UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/5 "2016-11-08T05:43:10Z")

</div>

I thought hero.say works similar to print:

#!/usr/bin/python

list = [1, 2, 3, 4, 5, 6, 7];  
print "list[1:5]: ", list[1:5]

When the above code is executed, it produces the following result −

list[1:5]: [2, 3, 4, 5]

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nick/32/784_2.png) [@nick](https://discourse.codecombat.com/u/nick)\
**Post date:** [November 8, 2016, 7:27am UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/6 "2016-11-08T07:27:11Z")

</div>

It’s just a bug in our interpreter with saying arrays of objects that have custom `toString` methods. Rob knows about it and will fix it when he gets down to the medium-priority bugs. 😉

---

<div class="post-metadata">

**Author:** ![juraj\_pechac](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/juraj_pechac/32/4987_2.png) [@juraj\_pechac](https://discourse.codecombat.com/u/juraj_pechac)\
**Post date:** [November 8, 2016, 12:56pm UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/7 "2016-11-08T12:56:21Z")

</div>

Javascript Interpreter is OK.  
var a=[1,2,3];  
hero.say(a);

When the above code is executed, it produces the following result −  
1,2,3

---

<div class="post-metadata">

**Author:** ![juraj\_pechac](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/juraj_pechac/32/4987_2.png) [@juraj\_pechac](https://discourse.codecombat.com/u/juraj_pechac)\
**Post date:** [November 8, 2016, 8:30pm UTC](https://discourse.codecombat.com/t/why-is-hero-say-enemies-not-possible/9567/8 "2016-11-08T20:30:01Z")

</div>

![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/4/469b422e737d85877b4e4bc15a6599aa9f95f46f.png)
