Is it a short code for if...then...else?
Yes. It controls the direction of flow for the leds based on the value of ctr.