in reply to print behavior

While it doesn't explain your findings, the short answer is don't try to use a variable twice in a single statement if there is code in that statement that modifies the value held in that variable.