Ternary operator exercise