abstract ternary operation into its own function, oneElementIsTrue