Using the ternary operator to choose between two separate blocks of code