> prompts the user to enter a positive integer n to calculate the 1+2+3+...+n and2> prompts the user to enter a positive integer n to calculate the 1-2+3-4+5-6+...+n and4. Trapswhile (condition);V. Cyclic structure-do whileL Features: Must be executed once the body of the loopL while and do While loop comparisonint i=0;while (ii++;}int i=0;do{i++;} while (iSix, circular structure-for1. Simple and practicalL Running ProcessL Initialization statements can be multiple sentences (place printf in the
Chapter 23rd UNIX File SystemNamed pipe Mkfifo:mkfifo [-M mode] pipe. Named pipes must be created explicitly and will not disappear (the RM command can be removed).The proc file is a pseudo-file used to access kernel information. For example, if a process ID is 1952, the process-related information can be found in a file in the/proc/1952 directory.The VFS (virtual file system) implements the details of file
to use tags in Java is because there is a loop nesting, and you want to get from multiple layers of nestingBreak and continue.Introduce code snippets from thinking in Java to learn about:public class Labeldemo {public static void main (string[] args) {int i = 0;outer:for (; True;) {inner:for (; i The label of the notation for the signature plus ":", in multiple nested loops, continue tagging, indicating the next loop to enter the tag followed by the loop (similar to the continue in a single-lay
The process control commands used in Transact-SQL languages are similar to the common programming languages, with the following control commands.
4.6.1 IF ... ELSE
The syntax is as follows:
IF
[ELSE [conditional expression]
where
Example 4-9
declare@x int,@y Int,@z int
Select @x=1,@y=2, @z=3
If@x>@y
print ' X>y '--printing string ' x>y '
else if@
Here we talk about the process control of the stored procedure, if else,case, while, there is no for loop, these and c,c++,c# languages are poor.
First, let's see if else uses
Copy Code code as follows:
If condition
Begin
SQL statement
End
ELSE begin
SQL statement
End
Look at a simple example
Copy Code code as follows:
DECLARE @id INT--Declaring a variable
is a ';When ' B ' thenSelect ' P3 is B ';When ' C ' thenSelect ' P3 is C ';ElseSelect P3;End case; /* Condition not satisfied will be terminated */While P1>4DoSet p1=p1-1;End while;Select P1; Checka:loopSet p1=p1+1;If P1=14 ThenLeave Checka;End If;End Loop;Select P1; /* Conditional gratification will be terminated */RepeatSet p1=p1-1;Until P1=6End repeat;Select P1; END;$$ Set @p_in = 3;Set @p_out = 2;Set @p_inout = ' B ';Select ' Check procedure ' into @p4; Call Porc_person_02 (@p_in, @p_out, @
Tags: Lin output flow control AMP statement else number BooleanIf condition statement.Basic structure of an IF conditional statementIF PL/SQL and statementsEND IF;or IF PL/SQL and statementselse other statementsEND IF;DeclareCou Number: = number;BeginIf Cou >10 ThenDbms_output.put_line (' cou= ' | | COU);Elsif CouDbms_output.put_line (' Value less than 5 ');ElseDbms_output.put_line (' condition not satisfied ');End If;EndPL/SQL
used (COMMANDS; ...). and {COMMANDS; ...;} To express.Use parentheses (COMMANDS; ...) When the command is wrapped, the command executes in a child shell environment whose execution state is the execution state of the last command in commands.Use curly braces {COMMANDS; ...;} To wrap the command, you must have a space before and after the parentheses, commands and commands to use; Separate, the execution state of the last command as the execution state of the command group.Example:If ...; Then .
)else: Print ' End 'Break: Jump out of the current layer of the loop# !/usr/bin/python for in range: Print xif x = = 6: break Else: print'end'The contents of else are not executed herePass: occupies a positionExit: Exit#!/usr/bin/python forXinchRange (10): Printxifx = = 2: Print 'Hello', xContinue ifx = = 4: Pass ifx = = 5: Exit ()ifx = = 6: Break Print '*'*10Else: Print 'End'Four, whileWhen the condition fails, the normal end is execu
. If one is passed, none prompts for access to the resource without permission. If you are not logged in at this time, jump to the login page.5, when logging in, Myusernamepasswordauthenticationfilter class executes Attemptauthentication () method, obtains the attestation.6, after the successful login, call the Myuserdetailsservice class of the Loaduserbyusername () method to obtain a userdetail entity, the role of the method to authorize the user.7, repeat 2, 3, 4 steps to intercept access requ
Java Process ControlThe syntax of Java Process Control is similar to C + +, there are if...else, while, Do...while, for, Switch...case, and so on, here no longer describe the specific syntax, just for illustrative.
Output 99 multiplication table (upper right triangle):
public class Demo {public
static void Main (string[] args) {
int i, J;
For (
function__construct () {//Magic method, constructor without parameters,you can do it, not write it. Initial value } Public functionS1 () {$thisS2 ();//call the brothers and sisters with $this. } Public functionS2 () {Echo $this-A1; }}$name=NewName ();//class instantiationEcho $nameA2. "//Call the Class property, "-" is the pointer to the operator, followed by the property without the $ symbol$nameS2 ();//Calling class methodsclassname2{ Public $a 1= 0; Public $a 2= 1; Public fun
SET lev= ' not ';END case;(The following is a sample of the loop)DELIMITER//CREATE FUNCTION Test (n INT)RETURNS INTBEGINDECLARE num INT DEFAULT 0;DECLARE SUM INT DEFAULT 0;While NumSET num= num + 1;SET sum=sum + num;END while;RETURN SUM;end//DELIMITER;DELIMITER//CREATE FUNCTION Test (n INT)RETURNS INTBEGINDECLARE num INT DEFAULT 0;DECLARE SUM INT DEFAULT 0;Labl:loopSET num=num+1;SET Sum=sum+num;IF Num>=n ThenLEAVE labl;END IF;END LOOP labl;RETURN SUM;end//DELIMITER;DELIMITER//CREATE FUNCTION Te
;Current letter:pcurrent letter:ycurrent letter:tcurrent letter:hcurrent letter:ocurrent letter:ncurrent Fruit : Bananacurrent fruit:applecurrent Fruit:mangogood bye!Index1 #!/usr/bin/python2 3Fruits = ['Banana','Apple','Mango']4 forIndexinchrange (len (fruits)):5 Print 'Current fruit:', Fruits[index]6 7 Print "Good bye!"The built-in function Len () and range (), function Len () returns the length of the list, which is the number of elements. Range returns the number of a sequence.For .... e
Case Flow control:Case structures are used for condition judgments in a variety of situations. Similar to switch/case statements in other programming languages, but it is very different from the grammatical form.Case string inModeStatement;;Mode 2 | Mode 3)Statement;;*)statements executed by default ;;EsacTip: Esac is the case in turn.Break and Continue Break command allows you to jump out of a loop. break usually exits a loop or case statement after some processing. If it is in aAn embedded l
' Basic use if condition: code that satisfies the conditional execution: ' ' ' ' ' ' ' # age = Input ' ("* * Input Age:") # The result from input by default is STR,STR Format cannot be performed by Python basic Process Control-if. else
Gefa1aadtcfarw-k936.jpg "/>Method two: By using grep to determine whether the user's input contains non-numeric, if not included, then output 0, if included, Output 1.650) this.width=650; "style=" Float:none; "title=" if3. JPG "alt=" wkiom1cd41-xavmyaadwcjzwsls453.jpg "src=" http://s3.51cto.com/wyfs02/M02/7E/8D/ Wkiom1cd41-xavmyaadwcjzwsls453.jpg "/>Validation results: The script names of the two methods are if2.sh,if3.sh650) this.width=650; "style=" Float:none; "title=" Ifresult. JPG "alt=" wk
While Loop :Description: The while loop is an indeterminate loop, also known as a conditional loop. As long as the condition is judged, the loop will continue to execute until the condition is judged, and the loop will stop, which is not the same as for the fixed loop,1 while [conditional judgment] 2 Do 3 procedure 4 DoneExample:1[Email protected] bash]#VIWhile1.SH2#!/bin/Bash3 #从1到1004I=15s=06 while[$i-le -] ; Do7s=$ (($s +$i))8i=$ (($i +1 ))9 DoneTen Echo "The sum
procedure 3elifthen4 The current condition judgment 2 is established, the procedure executed 5 ....... Can write multiple 6Else7 When all conditions are not true, the program executed 8fiExample: 1#!/bin/Bashread-P"Please input-a filename:" file# receive keyboard input and assign to variable fileif[-Z"$file"]# to determine if the variable file is empty Then Echo "Error Please input a filename"Exit1elif[!-E"$file"] ; Then# Determine if the value of file existsEcho "Your in
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.