Your "x" never equals 1, because there is no input for it to change to 1 and at the top you have it as 2.
What are you trying to do with the code, what is its purpose?
The original code was to print out "x" only ONCE, if it equaled 1023 and if the input changed to a new number and then back to 1023.