Page 24 - PowerPoint Presentation
P. 24

Conditional Operator











            o Conditional operator: ternary operator or arithmetic if



            o Takes three operand

                                                           Expression1? Expression2: Expression3

            o Syntax:



            o if Expression1 is TRUE then the computer will execute Expression2, but if Expression1 is


                  FALSE then the computer will execute Expression3
   19   20   21   22   23   24   25   26   27   28   29