The initial Delta Location is Value1 which is X=0
The final Delta Location is Value2 which is X=1
So if the cube Local Location(var) is anything but Value1, which it is as soon as I move it a little bit and it leaves 0, then the cube Delta Location must be changed to Value2, so the cube jumps to X=1.
Since the first IF part of the expression also determines that the Delta Location must not be exactly Value2, and now it is, then the IF becomes invalid and the Else part happens, so when I try to move the cube from X=1 back to zero it then checks if the Local Location is less than Value2 and also not exactly Value2 meaning that it just left X=1. If yes, then the cube's Delta Location must be changed to Value1, so the cube jumps to X=0, back to the start.
The last Else is unnecessary because it never happens, but I must use it for the expression to be valid.
I also added a limit location constraint to keep the cube inside the 0-1 range.