# Why are two rects displayed

**URL:** https://discourse.processing.org/t/why-are-two-rects-displayed/33393
**Category:** Coding Questions
**Created:** [November 8, 2021, 10:38am UTC](https://discourse.processing.org/t/why-are-two-rects-displayed/33393 "2021-11-08T10:38:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MoonAlien822](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)
#### Post date: [November 8, 2021, 10:38am UTC](https://discourse.processing.org/t/why-are-two-rects-displayed/33393/1 "2021-11-08T10:38:06Z")

</div>

when i press on the kill icon, two rects are displayed when only one should  
https://openprocessing.org/sketch/1333291/embed/?

---

<div class="post-metadata">

### Author: ![philipplehmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/philipplehmann/32/4111_2.png) [@philipplehmann](https://discourse.processing.org/u/philipplehmann)
#### Post date: [November 8, 2021, 1:36pm UTC](https://discourse.processing.org/t/why-are-two-rects-displayed/33393/2 "2021-11-08T13:36:43Z")

</div>

Those two lines are quite weird.

```auto
// there is a number defined
static final int NUM = 2;

// You have an array where you create multiple textboxes. Those get displayed here:
// A for loop which calls actions in multiple tbox objects
for (int i = 0; i != NUM; tboxes[i++].display());

```

For readability I would write it like that:

```auto
for (int i = 0; i<1; i++) {
    tboxes[i].display()
};

```
