Switch statement Language Reference <br>
<br>
<br>
Description <br>
When the value of the specified expression matches a label, the corresponding one or more statements are executed. <br>
Grammar <br>
switch (expression) {<br>
case label:<br>
statementlist<br>
case label:<br>
statementlist<br>
...<br>
default:<br>
statementlist<br>
} <br>
The syntax of the switch statement consists of the following: <br>
<br>
Part & nbsp; description <br>
expression An expression for the requirement value.
<br>
label & nbsp; according to expression to match the identifier. If the label = = = Expression, the execution begins immediately after the colon statementlist until an optional break statement is encountered, or the end of the switch statement is reached.
<br>
Statementlist one or more statements to be executed.
<br>
<br>
<br>
Description <br>
Use the default clause to provide a statement that is executed only if none of the tag values match the expression. It can appear anywhere within the switch code block.
<br>
You can specify 0 or more label blocks. If there is no matching value for the label and expression, and no default is provided, no statements are executed. <br>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.