2 Replies
one just
► "
pulls" the GPIO pin "up" to logic voltage (5V on an UNO/NANO) which keeps it HIGH until the button is pressed
while the other simply
► "pulls" the pin "down" to ground/GND which keeps it LOW until your button is pressed.
☝️ this prevents the pin from "floating" (just hanging there which could read as HIGH or LOW depending on environmental factors) ... so without the pullup or pulldown resistor, you'll get some "ghost" readings (your code will think the button was pressed even if it wasn't) ...
🤓 for more information (another explanation) see:
► https://discord.com/channels/420594746990526466/451158319361556491/1404422094409826365
► https://www.instructables.com/Understanding-the-Pull-up-Resistor-With-Arduino/huh