Syntax:
(click image to view)
The syntax above shows a blocks of code to be executed, if the condition is true. But how it works? I'm telling you, first, we have a n expression that is evaluated once. Then, its value will compared with the values for each case in the structure. If there is a match, the block of code associated with that case is executed. We will use break to prevent the code from running into the next case automatically. If no match found, the default will be used. For instance:
(click image to view)
No comments:
Post a Comment