There is one more way of declaring an if/else statement, and it is called a ternary operator.

It is a one line statement that follows the same logic of if and else, but uses different symbols instead. Can you figure out the symbol for if?

The first statement in the ternary operator is a condition and is followed by the operator ?, which stands in for the if  keyword. The : represents else.

If the condition is true, the code before the : will be executed. If it is false, the code after the : will run. Cool huh!?

An if statement is basically a question, isn't it ?