This is a sample code for using buttons in Arduino.
It's not well known, but when you use a pull-up, you can easily use the buttons with no pull-up resistance.
If you connect the Ground to the second port of the Degital (by pressing the button), you will be aware of this.