i want above expression to work same without “if” and ternary operator.Can we solve it by logical operator?