You are correct; it is a potentially infinite loop. There needs to be a blocking statement inside the loop or some other mechanism to get the expression to change to false if it started out true. If you see this in “working code” , it either was always false when executed, or was never executed.