A == A + 1 is not a mathematical statement. The student was correct when he said a = a +1 is impossible. The teacher was wrong.
You’ve got it backwards.
The single equal sign assigns the left side to the right which increments variable ‘a’ by 1.
The double compares. Since the value can’t equal itself plus 1, the comparison is always false.