The example given is potentially confusing. If we assume that the robot is facing towards positive X, then the loop will never end. Only if the robot is facing towards negative X initially will the loop end. You don’t specify, so the example could work. But I think beginners may expect the robot to be facing toward positive X (as it is in the sim). It’s not a bad thing to get learners to distinguish between forward movement and movement in the positive X direction, but you might want to make that a little more explicit.
This proves to be an issue in exercise 3.2. As the example is written, the robot just keeps moving backward. Also discovered that ctrl-c didn’t return me to the command line. I had to use ctrl-z and then kill the program on the command line.