Page 188 - CITS - Computer Software Application -TT
P. 188

COMPUTER SOFTWARE APPLICATION - CITS




           •  The expression is evaluated once































           •  The value of the expression is compared with the values of each case

           •  If there is a match, the associated block of code is executed
           •  The break keyword breaks out of the switch block
           •  The default code block is executed if there is no match
           Example
           The break Keyword
           When PHP reaches a break keyword, it breaks out of the switch block.
           This will stop the execution of more code, and no more cases are tested.

           The last block does not need a break, the block breaks (ends) there anyway.




































                                                           175

                             CITS : IT&ITES - Computer  Software Application - Lesson 47 - 62
   183   184   185   186   187   188   189   190   191   192   193