Help understanding Arduino Push button wiring

Hello,
I am trying to better understand the pushbutton and tutorial. I want the push button to output a HIGH value or 1 to serial monitor when pressed and a LOW value or 0 when not pressed. If I wire it up according to diagram 1, I always get a 1 and then a 0 when I push the button. If I wire it using diagram 2 (from arduino reference page) then I get what I want which is a 0 when not pressed and 1 when pressed.

Can someone help explain to me the difference in terms of the wiring? I don't know why the wiring in diagram 1 gives a different output than diagram 2.

Please note the pin is different in both images. In diagram 1 it is pin 13 and diagram 2 it is pin 2. I am using pin 2 to match the code in my physical wiring setup.

Thanks!
Code I'm using is same as the one from the tutorial:
/*
DigitalReadSerial

Reads a digital input on pin 2, prints the
result to the serial monitor

This example code is in the public domain.
*/

int buttonState = 0;

void setup()
{
pinMode(2, INPUT);
Serial.begin(9600);

}

void loop()
{
// read the input pin
buttonState = digitalRead(2);
// print out the state of the button
Serial.println(buttonState);
delay(10); // Delay a little bit to improve simulation performance
}

It might be better to look at a schematic to see the difference between the two circuits.

This shows 3 different ways to wire a switch S1, S2, and S3.

S2 and S3 are actually the same circuit, S3 uses an input resistor to 5v i.e. pullup resistor.

The circuit S1 and R4(10k) will give a LOW on pin D10 when the switch ‘is not’ closed (released) and makes pin D10 HIGH when the switch is closed (pushed).

Ok, thanks!

Connecting the pushbutton - or any switch - between the pin and ground so that it pulls LOW when closed (pressed) is almost always the preferred practice since it avoids taking the 5 V supply line any distance to the switch where it could be at risk of a short circuit to ground, or picking up interference.

/*
  DigitalReadSerial

  Reads a digital input on pin 2, prints the
  result to the serial monitor

  This example code is in the public domain.
*/

int buttonState = 0;

void setup()
{
  pinMode(2, INPUT);
  Serial.begin(9600);

}

void loop()
{
  // read the input pin
  buttonState = digitalRead(2);
  // print out the state of the button
  Serial.println(!buttonState);
  delay(10); // Delay a little bit to improve simulation performance
}

Without changing your circuit this modified code should also do the job of printing 1 when pressed and 0 when not pressed. I'll leave finding & understanding the modification as exercise to the reader.