No cloning theorem and exclusive-or (XOR) operator According to IBM's website,

[...]where we would [classically] have done an assignment (x=y), we instead initialize the target (x=0) and use exclusive or (x^=y).

This sounds like x is a copy (clone) of y, however cloning is impossible in quantum mechanics. What's going on?
 A: This is a standard trick in quantum computing: to allow reversibility when computing some function $f$, you keep all the inputs and you encode the result in an initially "blank" qubit set initially to $|0\rangle$. What you're describing is the simplest case: one single input qubit, and $f$ equal to the identity function.
Thus, you want your gate to take the state $|0\rangle|0\rangle$ (where the first qubit is the input and the second is blank) to $|0\rangle|0\rangle$ (i.e. keep the first one and compute on the second one), and to take $|1\rangle|0\rangle$ into $|1\rangle|1\rangle$. As the IBM website points out, one can do this with a CNOT gate controlled on the first qubit.
The no-cloning theorem, however, is not broken. Consider what happens when you input some general state $|\psi\rangle=a|0\rangle+b|1\rangle$: by linearity, the output will be
$$a|0\rangle|0\rangle+b|1\rangle|1\rangle.$$
This is an entangled state, and definitely not equal to the cloned state $|\psi\rangle|\psi\rangle$.
The way to interpret this is that the standard classical logic gates - assignment, OR, AND, etc. - are indeed implementable exactly as in (reversible) classical computing for the computational basis, but their behaviour on a general state is then fixed by linearity and must then be examined to see what it comes out as. Thus "assignment" works on the computational basis but not for a superposition state. Other gates like AND or OR don't even make much sense as such if their inputs are in (separable) superpositions or even entangled.
