In summary, the use of switch is to determine if the expression after the case matches the expression after switch, and once the case is matched, the subsequent program code is executed, regardless of whether the following case matches until the break was met . Do not match to find default. No matter where default is placed. As soon as a junction (
Case has two formats. Simple case functions and case search functions.
-- Simple case Function Case Sex When '1' Then Male' When '2' Then Female' Else 'Others' End -- Case search function
If statements process two branches, the IF-else-If structure must be used when processing multiple branches. However, if there are many branches, the more nested if statement layers,ProgramIt is not only huge but also difficult to understand. Therefore, the C language provides a conditional selection statement specifically used to process multi-branch structures, calledSwitch
Select Case statement
Execute several sets of statements based on the expression value.
Select Case testexpression[Case expressionlist-n[statements-n]] . . .[Case Else expressionlist-n[elsestatements-n]]End SelectParameters
Testexpression
Any number or string expression.
Exp
label: des Io ar uses on art log EF as
For such a combined logic circuit [email protected] (x) Case (x) x1: X2 :...... Endcase if the branch item contains all the values of variable X and does not overlap with each other, there is no need to use a comprehensive command in this case. (1) Some books in "// synthesis parallel_case" are used to introduce case statem
SQL server's case when then statement, sqlcase
-- Select DataName,-- Case Code---- When 'w01' then 'male'---- When 'w07 'then' female'---- Else 'others'---- End as Code-- From dbo. HistoryData
Select DataName,(CaseWhen Code = 'w01' then 'male'When Code = 'w07 'then' female'Else 'others'End)From HistoryData
The access database has SQL server-like
. Otherwise, execute action.
Instance (testuntil. Sh ):
#! /Bin/sh
A = 10;
Until [[$ A-lt 0]; do
Echo $;
(-));
Done;
Result:
Sh testuntil. Sh
109876543210
Iii. Shell selection statement (case and select usage)
Use Case/esac)
Syntax structure
Case $ ARG inPattern | sample) # ARG in pattern or sample;;Pa
If testexpression matches any of the case expressionlist expressions
, execute the statement between this case clause and the next one, for the last
clause, the statement is executed between the clause and the end Select, and the control
The statement that is transferred
One of the SQL statement judgment methodsCase has two formats. Simple case functions and case search functions.-- Simple case FunctionCase sexWhen '1' then 'male'When '2' then 'female'Else 'others' end-- Case search functionCase when sex = '1' then 'male'When sex = '2' then
(" has a great website ") Case
" Tim Cook ":
println (" CEO of Apple Inc. ")
Default:
println ("Someone Else")
}
In addition to being able to use a switch for strings, note here are some interesting things to do. Did not see the break. Because the execution of a case statement in the switch is not done down. No more chance to appear bug!
And for insta
The Oracle case statement is one of the most commonly used statements. The following describes the syntax of the Oracle case statement and provides an example to help you.
When multiple condition branch statements are executed, the Oracle case
This article will introduce the usage of the oracle/plsql case Condition Statement, which is similar to mysql mssql. If you need to learn more, let's take a look.
Statement syntax
The Code is as follows:
Copy code
CASE [expression]WHEN condition_1 THEN result_1WHEN condition_2 THEN result_2...WH
The switch case where you learned the choice statement today is a multi-select scenario that you can use.Case:Enter the month and the number of the output is how many days this yearThe 1,3,5,7,8,10,12 month is 31 days a year.This year's February is 28 days the other is 30 intM1 = to, M2 = -, M3 = to, M4 = -, M5 = to, M6 = -, M7 = to, M8 = to, M9 = -, M10 = to, M11 = -; ----don't need t
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
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
Next we will talk about the mysql stored procedure case statement syntax and instance tutorial. on the home page, let's take a look at the simple description of the case statement, and then explain the specific usage of the case with examples.
Next we will talk aboutMysql tu
Oracle experiences 1 -- oracle introduction @ basic SQL statement @ conditional query @ sort data theory and case studies1. Oracle IntroductionOracle is the first word for English translation of oracle (Oracle bone inscriptions) Unearthed from Yin. Oracle is the world's largest supplier of information management software and services. It was founded in 1977 and is headquartered in Redwood shore, California.
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
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.