The console
println(value) prints a value to the console — the dark panel that slides up from the bottom of the canvas. It's how you peek at what your code is doing. print(value) does the same thing.
TIP
When a sketch isn't behaving, sprinkle println(...) calls to print values and find out where things go wrong.