# Help resetting variables inside classes, arrays

**URL:** <https://discourse.processing.org/t/help-resetting-variables-inside-classes-arrays/39716>\
**Category:** Libraries\
**Tags:** homework\
**Created:** [November 14, 2022, 11:31pm UTC](https://discourse.processing.org/t/help-resetting-variables-inside-classes-arrays/39716 "2022-11-14T23:31:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 15, 2022, 12:00am UTC](https://discourse.processing.org/t/help-resetting-variables-inside-classes-arrays/39716/2 "2022-11-15T00:00:56Z")

</div>

Hello @moffmix,

This will restart from `setup()`:

```auto
void keyPressed()
  {
  if (key == 'r' || key == 'R')
    {
    music.stop();
    purr.stop();
    frameCount = -1; //next frame is setup() which is frameCount = 0
    }
  }

```

References:

- [https://discourse.processing.org/t/about-restarting/22557/3](https://discourse.processing.org/t/about-restarting/22557/3)
- [https://processing.org/tutorials/interactivity](https://processing.org/tutorials/interactivity)
- [https://processing.org/reference/keyPressed\_.html](https://processing.org/reference/keyPressed_.html)

`:)`

---

_[View the full topic](https://discourse.processing.org/t/help-resetting-variables-inside-classes-arrays/39716)._
