# How do you stop a timer as it reaches 0 in p5.js

**URL:** https://discourse.processing.org/t/how-do-you-stop-a-timer-as-it-reaches-0-in-p5-js/21240
**Category:** Beginners
**Tags:** homework
**Created:** [May 24, 2020, 2:06pm UTC](https://discourse.processing.org/t/how-do-you-stop-a-timer-as-it-reaches-0-in-p5-js/21240 "2020-05-24T14:06:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Johann75](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@Johann75](https://discourse.processing.org/u/Johann75)
#### Post date: [May 24, 2020, 2:06pm UTC](https://discourse.processing.org/t/how-do-you-stop-a-timer-as-it-reaches-0-in-p5-js/21240/1 "2020-05-24T14:06:22Z")

</div>

Referring the code made by Mr.Shiffman, i found that he couldn’t explain the code for stopping the timer at 0, so could anyone help with it…-Johann

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [May 24, 2020, 6:09pm UTC](https://discourse.processing.org/t/how-do-you-stop-a-timer-as-it-reaches-0-in-p5-js/21240/2 "2020-05-24T18:09:47Z")

</div>

> [@Johann75](#):
>
> Referring the code made by Mr.Shiffman

Link please! What video or example or book chapter etc. are you talking about? There are so many.

> explain the code for stopping the timer at 0

There are many kinds of timers, and many ways to stop them. Please give a longer explanation of what you are trying to do.

Also, is this a millisecond timer, or a frameCount timer, or a wall clock timer?

https://editor.p5js.org/jeremydouglass/sketches/iDkKMzH5Q

---

<div class="post-metadata">

### Author: ![Johann75](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@Johann75](https://discourse.processing.org/u/Johann75)
#### Post date: [May 25, 2020, 8:49am UTC](https://discourse.processing.org/t/how-do-you-stop-a-timer-as-it-reaches-0-in-p5-js/21240/3 "2020-05-25T08:49:02Z")

</div>

sorry friend i got clarified for tht doubt
