Conditions that change
Conditions get powerful when the value they test changes. Inside draw(), the special variable mouseX always holds the mouse's horizontal position — from 0 on the left edge to 400 on the right. Test it with an if and your sketch reacts to where the cursor is.
Each frame, p5 checks mouseX < 200. On the left half it's true (red); on the right half it's false (blue). The same idea works with any value — a score, a frameCount, a variable you change over time.
The pattern
Read a changing value, compare it in an if, and draw differently in each branch. That's the recipe behind buttons, games, and animations.