A button is a digital input device. It has two states, HIGH and LOW. Detecting it is as simple as digitalRead(button_pin).
On the other hand, if you want to detect a press, that is different, you want to detect essentially a transition from LOW to HIGH (or HIGH to LOW if you use pull-up resistor). To detect transition (in calculus terms, to calculate a derivative), you need to save the previous button status from the previous iteration and compare it with the current reading. If the previous state is LOW and the current is HIGH, you got a press, and you can do what you want when a button is pressed, such as increment a variable. Apparently you need a variable to hold the previous state of the button and overwrite it every time at the end of an iteration with the current value.
Give it a try see if you can make it work. It should look like this:
start with previous state as LOW state
read current state
if previous state is LOW and current state is HIGH, button is pressed and do something as a response
update previous state with current state