Code shorten with ternary