put ternary in `for` loop