# Easy way to see variable values after sketch is run?

**URL:** <https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981>\
**Category:** Processing\
**Created:** [May 17, 2020, 7:22pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981 "2020-05-17T19:22:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jl33](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jl33](https://discourse.processing.org/u/jl33)\
**Post date:** [May 17, 2020, 7:22pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981/1 "2020-05-17T19:22:03Z")

</div>

I’m using Processing to work on some procedural generation stuff with a lot of random(), so for debugging/developing the code I often want to check what value some variable ended up throwing. I’m aware that if I know in advance what I want, I can get this by using a println() function when writing the program, but is there some tool that can help me find out various values after the sketch has been generated? Or am I going to have to basically create my own GUI in order to that?

Thanks!

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [May 17, 2020, 7:35pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981/2 "2020-05-17T19:35:03Z")

</div>

You could use the Processing debugger. Shameless self-promotion:

> **[Debugging Processing](https://happycoding.io/tutorials/processing/debugging#debugging-with-the-debugger)**
>
> How to fix errors in your code.

---

<div class="post-metadata">

**Author:** ![jl33](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jl33](https://discourse.processing.org/u/jl33)\
**Post date:** [May 17, 2020, 8:37pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981/3 "2020-05-17T20:37:44Z")

</div>

Ah, thank you! This looks so helpful. Am I doing something wrong though-- once the sketch has run through all steps the variables list grays out and I can’t expand any objects to see their variable values. I’m having trouble figuring out how to breakpoint it right before this happens.

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [May 17, 2020, 8:42pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981/4 "2020-05-17T20:42:51Z")

</div>

Right, the debugger is only active when the program is running. You’d need to set a breakpoint right before you exit.

---

<div class="post-metadata">

**Author:** ![jl33](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jl33](https://discourse.processing.org/u/jl33)\
**Post date:** [May 17, 2020, 11:40pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981/5 "2020-05-17T23:40:49Z")

</div>

Do you happen to know how breakpoints interact with loops? When I put a breakpoint inside my main for-loop, it obviously stops there the first time, and then pressing Continue makes it go for what seems like an arbitrary number of loop cycles before stopping again. Is there a rhyme or reason to how many times it stops within the loop?

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [May 17, 2020, 11:42pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981/6 "2020-05-17T23:42:37Z")

</div>

I would expect it to break the next iteration of the loop. Can you post some example code?

---

<div class="post-metadata">

**Author:** ![jl33](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jl33](https://discourse.processing.org/u/jl33)\
**Post date:** [May 17, 2020, 11:48pm UTC](https://discourse.processing.org/t/easy-way-to-see-variable-values-after-sketch-is-run/20981/7 "2020-05-17T23:48:29Z")

</div>

Ah, never mind, I figured it out-- the breakpoint had been on an internal IF statement so I think it was only breaking every time the IF condition was triggered to satisfy. Now I have it on a line that iterates no matter what, and it’s working as expected. Thanks!! 🙂
