upcoming voltage from a button
I see you are new to Arduino, so let's start:
1) if you say it works you might be using an circuit like this:



which is not all bad but you might find trouble. I explain: 

1. When you set pinMode(pin,INPUT); you tell arduino to enable a high-impedance state on that pin: it's equivalent to 100Mohm resistor in series in front of that pin, good for getting sensor readings, but when you use a switch the state/reading of that pin (HIGH or LOW) is "floating" when the switch is opened which will give unpredictable readings.
That's why you need to use a "pull-down" resistor, which means you pull down the value of that pin when the switch is OPENED by using GND as reference value for LOW so you are sure it goes down when switch is opened. The resistor also serves as protection (10Kohm is recommended) when the switch is CLOSED as it stops the high current flow/drain (!!5V pin connected to GND!!) that arduino can't support without (aka short-circuit).

2. So you end up with something like this:

I would personally put the resistor and the GND wire between the button and the digital pin wire.
I hope I was useful! If you need/want more documentation check those two links out:

https://www.arduino.cc/en/Reference/Constants look into "Defining Digital Pins modes" section

https://www.arduino.cc/en/Tutorial/DigitalReadSerial here you have an practical example.