Easy and Small Toggle Switch with Simple Pushbutton

Too wordy for me
Try this

const byte ledPin = 2;
const byte buttonPin = 3;
byte currentButtonState;
byte previousButtonState;

void setup()
{
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);
}
void loop()
{
  previousButtonState = currentButtonState;
  currentButtonState = digitalRead(buttonPin);
  if (currentButtonState != previousButtonState && currentButtonState == LOW)
  {
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

I don't claim that it is easy or idiot proof but at least it uses consistent data type

Of course, it really needs debouncing too