Easy way to see variable values after sketch is run?

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?


1 Like

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


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.

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

1 Like

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?

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

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!! :slight_smile:

1 Like