Hello. This might sound simple, but I can't find the reliable solution.

Say I have button, input pin, which is tied to VDD via 10K resistor.
Pressing button pulls input pin down.

There is in some code, say code1, which runs in loop.
When user press button, execution goes to code2, which also runs in loop.
While in loop2, when user presses the button, execution is returned to code1

The issue is, if user keeps button pressed, the code will jump from code1 to code2 and back from code2 to code1.

To avoid this, the button state should be checked, so when user presses the button while in code1, jump to code2 will not occur until he releases the button.

I tried to use BUTTON statement, but it is not handy, since it only can do jump to label, and sometimes I just want to change value of some variable. And sometimes buttons are tied to ADC, so different button returns different ADC value.

Is there a simple way for fixing the issue I have?