In other languages, the switch statement is probably like thisSwitch (VAR){Case VALUE1:DO_SOME_STUFF1 ();Case VALUE2:DO_SOME_STUFF2 ();...Case VALUEN:DO_SOME_STUFFN ();Default:do_default_stuff ();}Python itself does not have a switch statement, the
The first time I saw this switch-case syntax, I wrote a small test program in Linux source code.# Include
Int main (){Int Nr = rand () %128;Int * idx = & NR;Switch (NR ){Case 1: * idx = 0; break;Case 2 4: * idx = 1; break;Case 5 16: * idx = 2;
Switch... standard syntax of case
1 switch (variable to be selected) 2 {3 case value 1: Statement 1; 4 break; 5 case value 2: Statement 2; 6 break; 7 ....... 8 case value n: Statement n; 9 break; 10 default: Statement n + 1; 11 break; 12}
Java programming those things 34 -- switch statement syntax Zhengzhou game college Chen yuefeng from: http://blog.csdn.net/mailbomb
5.3.2 switch statementThe Chinese meaning of the switch keyword is the meaning of switch and conversion. The switch
Switch case is a qualified data in js, which is much simpler than if else. Next I will introduce my understanding of js switch case.
In the if Condition Statement, only one logical condition can exist. if multiple conditions exist, you can use
$a=5;switch($a){ case 6: echo "\$a is 6"; case 5: echo "\$a is 5"; case 4: echo "\$a is 4";}
As in the above example, my understanding is that each time $ A is compared to the value of the case, the output statement is the same, and the
Switch syntax The code is as follows:Copy code Switch (expression){Case constant expression 1: Statement 1;....Case constant expression 2: Statement 2;Default: statement;} Default is to execute it if there is no matching case. default is not
In an IF condition statement, a logical condition can only have one, and if there are multiple conditions, it can be resolved using nested IF statements, but this method increases the complexity of the program and reduces the readability of the
The switch can only compare values or characters, but do not think that it is not useful if so. If appropriate, it is more efficient than if Else. The syntax structure of the switch is as follows:
Switch (variable name or expression ){
Case must
You cannot use the switch statement in ASP, you need to use the Select Case statement
A Brief introduction
Select the work of the report, if the statement. The difference, however, is that they can check for multiple values. Of course, you
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.