Why does the LED turn on after the while loop becomes false?

Why so rude? I was merely pointing out the that I believe the statement
ledMode = ++ledMode % 8;
to be undefined behavior and a link to supporting evidence.