We can use ternary operator instead of if..else statement. It will take three arguments.
First argument is comparison statement.
Second argument will be executed, if the comparison becomes true.
Third argument will be executed, if the comparison becomes false.
It is as same as below,
Check whether the given number is positive or negative.
We can also write the same program by using if..else like below,