# Missing semicolon

**URL:** <https://discourse.processing.org/t/missing-semicolon/27721>\
**Category:** Beginners\
**Created:** [February 11, 2021, 1:24am UTC](https://discourse.processing.org/t/missing-semicolon/27721 "2021-02-11T01:24:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tea\_tree](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Post date:** [February 11, 2021, 1:24am UTC](https://discourse.processing.org/t/missing-semicolon/27721/1 "2021-02-11T01:24:29Z")

</div>

My code throws an error (“missing ;”) and I don’t know why…

```auto
  int i =0;
  while (i < books.size()){
    for(i<books.size(); i++){
}
}

```

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [February 11, 2021, 1:57am UTC](https://discourse.processing.org/t/missing-semicolon/27721/2 "2021-02-11T01:57:07Z")

</div>

Are you trying to do a for loop, or a while loop? You probably want a for loop, and not a while loop.

```auto
for( int i = 0; i < books.size(); i++ ) {
  // Do something in here with books[i].
}

```

---

<div class="post-metadata">

**Author:** ![tea\_tree](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Post date:** [February 11, 2021, 2:16am UTC](https://discourse.processing.org/t/missing-semicolon/27721/3 "2021-02-11T02:16:12Z")

</div>

Thanks! I got it to work 🙂 I do actually want a while loop and I managed to get it to work with

```auto
 int i =0;
  while (i < books.size()){
}

```

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [February 11, 2021, 5:08am UTC](https://discourse.processing.org/t/missing-semicolon/27721/4 "2021-02-11T05:08:18Z")

</div>

Okay! Just don’t forget to increment `i` inside your while loop! 😉
