Arduino code help needed

Hi all I am hunting for a piece of code I can use for the following action-
I want to be able to use a sensor, once i am happy with the reading I want to press a button and have the current reading to be copied and set as a datum for an “if” statement.

Hope this makes sense any help would be terrific!!

Rather than hunting for code, it's better to try to create it.
Along the way, you'll find out how to read a switch's state, how to debounce the switch, how to read the sensor and how to store its value.

Cheers for the input! You are correct and I do believe u have answered enough of my question for me to continue ! Thanks again mate