The ternary operator, also known as the short-hand if-else, comprises three operands and is employed to condense multiple lines of code into a single line.
It is commonly utilized to substitute straightforward if-else statements.
variable= |
Rather than composing:
int time = 20; |
You can easily express:
|