Learning PHP, MySQL, JavaScript, CSS & HTML5 by Robin Nixon

Learning PHP, MySQL, JavaScript, CSS & HTML5 by Robin Nixon

Author:Robin Nixon
Language: eng
Format: epub, mobi
ISBN: 9781491949467
Publisher: O’Reilly Media, Inc.
Published: 2014-05-31T16:00:00+00:00


Breaking out

As you can see in Example 15-14, just as with PHP, the break command allows your code to break out of the switch statement once a condition has been satisfied. Remember to include the break unless you want to continue executing the statements under the next case.

Default action

When no condition is satisfied, you can specify a default action for a switch statement using the default keyword. Example 15-15 shows a code snippet that could be inserted into Example 15-14.

Example 15-15. A default statement to add to Example 15-14

default: document.write("Unrecognized selection") break



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.