In the process of PHP web development, the speed of the website is closely related to the simplicity and complexity of the code. For example, when we need to specify a variety of conditions to execute different blocks of code, it is necessary to use the PHP related conditional statements, then how to use concise code to implement the multi-conditional judgment statement? This article will give you a detailed introduction to the specific use of PHP swi
block is no longer executed.Case 3: try{} catch () {return;} finally{} return;The program executes the try first, and if an exception is encountered to execute a catch block,Exception: code that executes before return in a catch, including expression operations in a return statement,Then execute all the code in the finally statement, and finally execute the return in the Catch block,The return
You may be familiar with the IF Else statement, which is used to control the process. A CASE statement statement has a similar effect in the world of SQL. The following is a simple introduction to the use of case statements. Consider the following scenario, assuming that the
Case ... Esac is similar to the switch ... case statement in other languages, and is a multi-branch selection structure.The case statement matches a value or a pattern, and if the match succeeds, the matching command is executed. The cas
judgment)Main (secret =View Code Main (number = (number >=( number >=View Code Main (useName = useSecret = (useName == useSecret =View Code Main (age = (age> =View Code Main (Console. WriteLine (age = (age >=( age >=input = (input =View Code
(In-depth understanding and application are also required)
Control the output of some statements: Apply the bool expression and add the if structure.
Bool variable = false;
If (variable = false)
{
Specifies whether the program is output.
}
It can solve s
Answer supplementYou can do this easily: Switch (a) {Case 0: Case 1: Case 2: printf ("lslksdjfl/N"); Case 3: Case 4: case 5: printf ("sdlfjsdlf/N"); default: printf ....}
Answer supplementCan you use the if
Case has two formats. Simple case functions and case search functions.1. Simple case Functions
Case sex when '1' then' male 'when' 2' then' female 'else' others' end
2. Case search functions
This is a creation in
Article, where the information may have evolved or changed.
Depending on the incoming condition, the SELECT statement executes a different statement. The following example prints a different content based on the input integer variable i:
Switch I {case 0: fmt. Printf ("0") Case 1:
Switch statements in PHP are used to perform different actions based on multiple different conditions. If you want to selectively execute one of several blocks of code, use a Switch statement.
Switch syntax
The code is as follows
Copy Code
switch (expression)//Set expression{Case Label1://Compare the value of label 1Code to is executed if expression = Label1; If matching the ou
MySQL can be used as an expression, or as a Process control statement in a stored procedure, as an expression:An If expressionIF(expr1,expr2,expr3)If Expr1 is true (expr1 Select*,if(sva=1,"male","female")as from where! = ""The IF as an expression can also be implemented with case:Select1' female 'END as fromwhere!=' In the return result of the first scenario, Value=compare-value. The return result of the second scenario is the real result of the
The Shell Case statement is a multi-select statement. A case statement can be used to match a value with a pattern, and if the match succeeds, the matching command is executed. The case statem
In VFP, you can use SQL statements to manipulate tables, and you do not need to open the database when you use SQL statements to manipulate tables. This example describes the Select query statement (data retrieval), and the format of the SELECT statement refer to the Select SQL command or the SQL language tutorial.
In the case of VFP: to locate and find the reco
10 cases of high-concurrency MySQLSQL statement optimization in the production environment: This case is a database optimization teaching case for the linux O M training of Old Boys. If any reposted, you must retain this copyright statement in your actual work, O M or DBA personnel
10 cases of high-concurrency MySQLS
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 program.
Using the switch Process Control statement can solve these problems perfectly, with the following basic structure:
Switch
Case statements are used to implement multiple if. else, but the usage is somewhat different, people who have learned other languages know that the case to match the variables, if there is a matching successful words to execute the corresponding statement. The case statement
1, determine whether a number is in the one-way.#!/bin/Bashread-P"pls input a number:"N Case "$n" inch 1) Echo "variable is 1" ;; 2) Echo "variable is 2" ;; 3) Echo "variable is 3" ;; *) Echo "pls input a number between 1 and 3"exit;Esac2, multi-level if statement rewriting#!/bin/Bashread-P"pls input a number:"Nif[$n-eq1]; Then Echo "$n is a variable 1"
Ext.: http://blog.csdn.net/wchinaw/article/details/7325641The main idea of the following article is that: in a generic Android project, the R class constants are defined with final, but after ADT 14, if in the library project, it will not have the final keyword,It is estimated that in the new ADT, the resource file becomes a library ...,In the case of the switch statement, if you use R.id.xxx, you will be p
This article was reproduced from: http://c.biancheng.net/cpp/view/7006.htmlC Language Chinese network launched remedial classes, including "c language tutorial, C + + tutorial, algorithm/Data Structure Tutorial", all are one-to-one teaching: a one-to-one tutoring + one-to-one answer + assignment + Project Practice + permanent learning. QQ Online, respond at any time!Case ... Esac is similar to the switch ... case
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.