Table of Contents
    Home / Definitions / Ternary Operator
    Languages 1 min read

    A ternary operator is some operation operating on 3 inputs. It’s a shortcut for an if-else statement, and is also known as a conditional operator.

    • In Perl/PHP it works as: “boolean_condition?true_value:false_value”
    • In C/C++ it works as: logical expression? action for true : action for false

     

     

     

     

    Was this Article helpful? Yes No