Mask-group

Conditional Operator



  • The conditional operators ? and : are ternary operators as they take three arguments.

  • They are foreshortened if-else.

  • The general form of conditional operator is:

Expression 1 ? expression 2 : expression 3

  • This means if expression 1 is true then return expression 2 else return expression 3.