Makey Makey on Leonardo - Rapid fire keystrokes

Move the Serial.println() statement up above the first if statement in that snippet. Make adjustments to the still mysterious thing connected to the analog pin. See what gets printed.

It should soon become obvious what the first if statement is doing.

The second is testing a boolean variable. If the value read from the analog pin has gone above the threshold (the 600), and it was not above before (check is false), check is set to true and some other stuff happens.

check is set to false when the value read from the analog pin drops below 300.

Explicit assignments, rather than toggling, might have made that clearer.