use if instead of ternary operator