# String versus (method?) - Backwoods Forest

**URL:** <https://discourse.codecombat.com/t/string-versus-method-backwoods-forest/5466>\
**Category:** Ambassador\
**Created:** [October 29, 2015, 1:57pm UTC](https://discourse.codecombat.com/t/string-versus-method-backwoods-forest/5466 "2015-10-29T13:57:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cat\_Crumpler](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cat_crumpler/32/3210_2.png) [@Cat\_Crumpler](https://discourse.codecombat.com/u/Cat_Crumpler)\
**Post date:** [October 29, 2015, 1:57pm UTC](https://discourse.codecombat.com/t/string-versus-method-backwoods-forest/5466/1 "2015-10-29T13:57:13Z")

</div>

Hey Ambassadors,

There’s a level in the Backwoods Forest world where you attack a Chest unless there are enemies present. Why is “Chest” a string, but enemy is just enemy? Why is enemy not a string (i.e. not in quotes)? (and if my verbiage is off, feel free to correct me)

Thank you!!

Cat

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [October 29, 2015, 2:25pm UTC](https://discourse.codecombat.com/t/string-versus-method-backwoods-forest/5466/2 "2015-10-29T14:25:56Z")

</div>

The `attack` method is formatted as `attack(string)`, where `string` is an input argument. This string represents a thang with name `string`. When you `attack("Chest")`, you are attacking the thing with name `"Chest"`, in this case, the chest. However, when you use `attack(enemy)`, You are attacking the string you previously stored in `enemy` with `findNearestEnemy()`. Does that clear things up?

---

<div class="post-metadata">

**Author:** ![Cat\_Crumpler](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cat_crumpler/32/3210_2.png) [@Cat\_Crumpler](https://discourse.codecombat.com/u/Cat_Crumpler)\
**Post date:** [October 29, 2015, 9:46pm UTC](https://discourse.codecombat.com/t/string-versus-method-backwoods-forest/5466/3 "2015-10-29T21:46:40Z")

</div>

That makes sense. The game programmers named and defined “Chest” already, yes? Or is that spot on the map just “Chest” because we called it “Chest”?

Thank you!

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [October 29, 2015, 10:59pm UTC](https://discourse.codecombat.com/t/string-versus-method-backwoods-forest/5466/4 "2015-10-29T22:59:04Z")

</div>

They have indeed named the chest “Chest”. It’s like in Kithgard Dungeon, where you used string like `"Treg"` to attack munchkins.
