Error in AttachInterrupt example

The example on the Arduino website has a bug I think. The code is:

int pin = 13;
volatile int state = LOW;

void setup() {
    pinMode(pin, OUTPUT);
    attachInterrupt(digitalPinToInterrupt(pin), blink, CHANGE);
}

void loop() {
    digitalWrite(pin, state);
}

void blink() {
    state = !state;
}

As written, this uses the same pin, 13, both to power the LED and for the interrupt. There should be two different pins used, e.g.:

int ledPin = 13;
int intPin = 2;
volatile int state = LOW;

void setup() {
    pinMode(ledPin, OUTPUT);
    attachInterrupt(digitalPinToInterrupt(intPin), blink, CHANGE);
}

void loop() {
    digitalWrite(ledPin, state);
}

void blink() {
    state = !state;
}

+1
You are correct, however we moderators are not able to edit the examples.

The first post here shows better code

I'll move this thread to the right sub-forum, so it might be picked up.