Can I give pin 39 two different names

My program raises and lowers a gate and it has a real time clock in it.

Can I give pin 39 two different names. It does not come up as an error?

const int Gate_Down_Switch = 39;

const int hourButtonPin = 39;

Are the wires connected to the same pin??????

I am using the same switch to make the gate go up calibration mode and I'm using the same switch to set the clock (increase hours) in setup mode.

Sure. The pin will react digitalWrites (for example) from either name tho, probably not what you want. Only needs to be a byte as well.

If you then set the pinModes in setup:

pinMode (Gate_Down_Switch, INPUT_PULLUP);
and
pinMode (hourButtonPin, OUTPUT);

the last one used will be the one used - so if you have it set to OUTPUT last, and then you connect it Gnd with a button to Gnd, you will damage the pin.
You can also change in "on the fly" in the code if you need it to change between input & output.

Thanks,

Both will act as INPUTS.

Appreciate the info.

BTY, I like your website.

Sid

Thanks.
No matter what you call them, the same physical pin will be read with

digitalRead(Gate_Down_Switch );
and
digitalRead(hourButtonPin);

If both are normally open (assuming internal pullup, and button/switch closure connects the pin to Gnd)
then either one can bring it low and provide a good indication that something happened.
If one is low as a static state (like the gate is down and not moving, closing it's switch), then you can press hourButton all you want and it will only return low, so that would impede using it as a button as you couldn't get a high from it.
If the sketch leaves the gate so that switch is open, and enters some time setting subroutine, that would let the time set occur, and not make gate take some action based the high/lows occurring on the pin.