# \[SOLVED\] Sarven Savior Help!

**URL:** <https://discourse.codecombat.com/t/solved-sarven-savior-help/24499>\
**Category:** Level Help\
**Created:** [September 28, 2020, 7:35pm UTC](https://discourse.codecombat.com/t/solved-sarven-savior-help/24499 "2020-09-28T19:35:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wincon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wincon/32/15097_2.png) [@Wincon](https://discourse.codecombat.com/u/Wincon)\
**Post date:** [September 28, 2020, 7:35pm UTC](https://discourse.codecombat.com/t/solved-sarven-savior-help/24499/1 "2020-09-28T19:35:05Z")

</div>

```python
# An ARRAY is a list of items.
# This array is a list of your friends' names.
friendNames = ['Joan' 'Ronan' 'Nikita' 'Augustus']
# Array indices start at 0, not 1!
friendIndex = 0
# Loop over each name in the array.
# The .length property gets the length of the array.
while friendIndex < friendNames.length:
    # Use square brackets to get a name from the array.
    friendName = friendNames[friendIndex]
    # Tell your friend to go home.
    # Use + to connect two strings.
    hero.say (friendName + ', go home!')
    # Increment the index to get the next name from the array.
friendIndex += 1
# Go back and build a fence to keep the ogres out.
hero.moveXY (26, 30)
hero.buildXY ('fence', 29, 30)

```

---

<div class="post-metadata">

**Author:** ![Wincon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wincon/32/15097_2.png) [@Wincon](https://discourse.codecombat.com/u/Wincon)\
**Post date:** [September 28, 2020, 7:36pm UTC](https://discourse.codecombat.com/t/solved-sarven-savior-help/24499/2 "2020-09-28T19:36:21Z")

</div>

I tried other people post but it didn’t help, my code is on the top.

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [September 28, 2020, 7:39pm UTC](https://discourse.codecombat.com/t/solved-sarven-savior-help/24499/3 "2020-09-28T19:39:12Z")

</div>

Hello and welcome to codecombat discourse @Wincon! 🥳 This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review [this topic](https://discourse.codecombat.com/t/welcome-to-codecombat-discourse-forums/15601), which shows all essentials of this board! Thanks!

> [@Wincon](#):
>
> ```python
> while friendIndex < friendNames.length:
> # Use square brackets to get a name from the array.
> friendName = friendNames[friendIndex]
> # Tell your friend to go home.
> # Use + to connect two strings.
> hero.say (friendName + ', go home!')
> # Increment the index to get the next name from the array.
> friendIndex += 1
> 
> ```

Why don’t you increase friendIndex in the while loop? Because this is what causes the infinite loop.

Andrei

---

<div class="post-metadata">

**Author:** ![Wincon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wincon/32/15097_2.png) [@Wincon](https://discourse.codecombat.com/u/Wincon)\
**Post date:** [September 28, 2020, 7:45pm UTC](https://discourse.codecombat.com/t/solved-sarven-savior-help/24499/4 "2020-09-28T19:45:38Z")

</div>

wow, I can’t believe I missed that! Thank you for your help!

---

<div class="post-metadata">

**Author:** ![Lydia\_Song](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/lydia_song/32/31461_2.png) [@Lydia\_Song](https://discourse.codecombat.com/u/Lydia_Song)\
**Post date:** [September 28, 2020, 7:57pm UTC](https://discourse.codecombat.com/t/solved-sarven-savior-help/24499/5 "2020-09-28T19:57:11Z")

</div>

Congrats on solving the level! Can you check the tick mark next to the comment that helped you the most?  
Lydia

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [September 28, 2020, 8:57pm UTC](https://discourse.codecombat.com/t/solved-sarven-savior-help/24499/6 "2020-09-28T20:57:57Z")

</div>


