Why an if/else block rather than a ternary for this operation?