Replaces an if-statement with an equivalent ternary operation.