Could someone please explain the concept of switch variables (binary integer decision variables) in linear programming?

This example has two alternative constraints

$$\begin{array}{ll} \text{maximize} & 1.5x\_1 + 2x\_2\\ \text{subject to} & x\_1, x\_2 \leq 300\\ & x\_1 = 0 \quad \mbox{XOR} \quad x\_1 \geq 10\end{array}$$

I have seen examples of solutions for such tasks by applying something like following:

$$x\_1+My\_1 = 0\\x\_1 - My\_1 \geq 10+M$$ 

Does someone know and understand this approach and can explain it to me?