QUESTION:I has this if statement:if (input = = ' Day ') Console.Write ({0}, Daydata); When the user types ' day ' it should is so, the the console writes the data in that array. It works fine but was there anyway to get it to work if the user types ' day ' or ' day ' etc. I know I could do:if (input = = ' Day ' | | input = = ' Day ' | | input = = ' Day ') Console.WriteLine ({0}, Daydata); But was there anyway to make it shorter and tidier? Thanks. Answer:if (input. ToLower () = = "Day") {}C # Ig
#include Title: Ask 1+2+...+n, do not use multiplication, for, while, if, else, switch, case, and other keywords and conditional judgment statement (A? B:C)
Method 1: Recursive, using logic and short-circuit characteristics Public class Solution { int sum_solution (int n) { int ans = n; (ans + = sum_solution (n-1)) ; return ans; }}Act 2. Calling Java library functions Public class Solution { publicint sum_solution (int n) { int Sum = ( C10>int) (Math.pow (n,2) + n); return sum>>1;} }Ask for 1+2+3+...+n, the request cannot use multiplication method, for, while, if, else, switch,
The syntax for a case when statement in SQL is as followsSimple Caseexpression: Caseinput_expression whenWhen_expression ThenResult_expression[. .. n] [ELSE else_result_expression] ENDsearched Caseexpression: Case whenBoolean_expression ThenResult_expression[. .. n] [ELSE else_result_expression] ENDWhere result_expression is supposed to be an arbit
Select Case is a condition to choose his advantage is the only export, a lot of time he is much better than if else oh.Select1%>
The syntax for the SELECT statement is as follows:Select Case ExpressionCase Label_1Statements_1Case Label_2Statements_2...Case ElseStatements_nEnd Select
For more details please see: htt
) b where a date=b. Date We might as well review the syntax of case.Case when there are two uses, one is similar to the example in the above simple cases function:Result ' wins '1' negative '20END There is also a case search function:Result=' win '1result=' Negative '20END Where result= ' wins ' can be replaced by other conditional expressions. If more than one case-when expre
Sometimes a long if statement makes a program very difficult to read, and with a case, you can make the case statement more conciseThe case syntax is in the following format:Case expression inpattern1) suite1;; PATTERN2) Suite2;; ... patternn) Suiten;; *) Other_suite;; EsacP
specified user
BaseName directly obtains the file base name, cannot take the directory name of the command itself, the script itself executes script when the script path base name
Mail:echo "Mail Content" | Mail-s "Mail name" (root or send mail to other users)
Generate random Number:
RANDOM: Variable within range 0-32768 ($RANDOM)
Case
Case $ variable in
value1)
Tags: looping syntax Select result instance out Lin style outputCase Loop statement:1: GrammarThe basic form of a case statement is:Case SelectorWhen Expression1 then RESULT1When Expression2 then RESULT2When Expressionn then RESULTN[ELSE resultn+1]END;2: ExampleDeclareV_annum char (1): =upper (' nom ');V_appression VARCHAR2 (30);BeginV_appression: =
One. Select the day of the week with switchIn this case, for example: case= "Monday"Two. Use switch to select simple numbersIn this case, for example: case= ' 1 'Three. Use switch to select a value that has the function appliedExample: Switch (Preseint (GRADE/10)) {Case=6:do
Application of/switch caseConsole.WriteLine ("1. Hamburger");Console.WriteLine ("2. French fries");Console.WriteLine ("3. Chicken nuggets");Console.WriteLine ("4. Chicken Leg");Console.WriteLine ("5. Chicken rice flower");Console.Write ("Please enter your choice of item number:");String a = Console.ReadLine ();Switch (a)//in parentheses is the variable name that is judged{Case "1": The value behind the//case
Examples are as follows:
Data table is demotable, field has ID, condition1,condition2,condition3,condition4,condition5
The requirement is to query demotable, condition1,condition2,condition3,condition4,condition5 Five fields that meet any of two or more than two conditions.
You can use case when to implement this condition, requiring nested subqueries
Examples of SQL statement code are as follows:
Label:Keyword is case insensitiveFor example, select, from, case can beIdentifiers are case-sensitiveFor example, table name, column nameIf the identifier is not double-quoted, the default is uppercaseIdentifiers are executed in the original case if double quotation marks are addedHowever, when the table name is enclos
The case syntax in shell is as follows:Case word in pattern1) Statement (s) to be execute if pattern1 matchs; pattern2) Statement (s) to be execute if pattern2 matchs; pattern3) Statement (s) to be execute if pattern3 matchs; *) Default action ;;
Esac
[Note] the pattern mode cannot contain metacharacters :*,? , [...]
2.4Switch/case replacementThe Switch/case statement is now emulated, but it is also run at compile time. First look at the calling code and output resultsTest casecout Test Casecase 2Implementation code is very simple, or template-specificTemplate}};template
}};
C + + template metaprogramming Five: switch/case
The table game_info is known as follows
Date_info
Result_info
2018-2-4
Win
2018-2-4
Lose
2018-2-4
Win
2018-2-4
Lose
2018-2-5
Lose
2018-2-5
Lose
2018-2-5
Lose
Q. How do I find the following results?
Date_info
Win
Lose
2018-2-4
2
2
2018-2-5
0
3
Tags: control statement CTO ROC read case share picture COM ASE pngThe Linux shell has learned several times.But the memory is not good, always forget, chase the main reason may be not common reason!Case beginning Esac EndHere's the result.Input method does not enter the symbol is wrong, the beginning of the total error, and then switched the input method is good
Grammar:Case SelectorWhen Exp1 then Res1When Exp2 then Res2When Exp3 then Res3...[ELSE RESN]EndSql> Declare2 Mygrade char (1): = ' A ';3 res varchar2 (20);4 begin5 Res: =6 Case Mygrade7 when ' A ' and ' The mark is 90-100 '8 when ' B ' and ' The mark is 80-90 '9 when ' C ' and ' The mark is 70-80 'When ' D ' and ' The mark is 60-70 'Once ' E ' then ' the mark is 0-60 'The END;Dbms_output.put_line (RES);The end;15/The Mark is 90-100PL/SQL procedure suc
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.