# Unit 7 Lesson 8- student's code stuck in a loop

**URL:** <https://forum.code.org/t/unit-7-lesson-8-students-code-stuck-in-a-loop/39294>\
**Category:** Coding and Debugging Help\
**Created:** [April 11, 2024, 3:07pm UTC](https://forum.code.org/t/unit-7-lesson-8-students-code-stuck-in-a-loop/39294 "2024-04-11T15:07:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bethany.baldwin](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bethany.baldwin](https://forum.code.org/u/bethany.baldwin)\
**Post date:** [April 11, 2024, 3:07pm UTC](https://forum.code.org/t/unit-7-lesson-8-students-code-stuck-in-a-loop/39294/1 "2024-04-11T15:07:28Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/4/49da894816921c9fa65fdea013787f01071c503a.png)

Our class is currently in unit 7 lesson 8 where they are making code for a library. One of my student’s code seems to be getting stuck in this conditional in a loop and whether is it spring fever or tired eyes, we are having a difficult time debugging why.

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [April 11, 2024, 4:16pm UTC](https://forum.code.org/t/unit-7-lesson-8-students-code-stuck-in-a-loop/39294/2 "2024-04-11T16:16:22Z")

</div>

Line 15 looks off …

Shouldn’t it be:

for (var i = 0; **i \<** popularity.length-1; i++) {

without the i \< part, I don’t think it will count properly.

Mike

---

<div class="post-metadata">

**Author:** ![bethany.baldwin](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bethany.baldwin](https://forum.code.org/u/bethany.baldwin)\
**Post date:** [April 11, 2024, 4:37pm UTC](https://forum.code.org/t/unit-7-lesson-8-students-code-stuck-in-a-loop/39294/3 "2024-04-11T16:37:13Z")

</div>

Mike, thank you! I think sometimes the longer I stare at some of these, the easier it becomes for me to miss the simple set up issues.
