Int fun () { int I = 0, a = 0; DO { A + = I; }while (I return; }
Main disassembly code:
Do{A + = I;00ad1a3c mov eax, dword ptr [A]00ad1a3f add eax, dword ptr [I]00ad1a42 mov dword ptr [a], eax} While (I 00ad1a45 cmp dword ptr [I], 64 h00ad1a49 JL
The do-while statement will loop at least once ,.Its syntax is as follows:Do {Statement (s)} While (booleanexpression );Simple instancePublic class mainclass {Public static void main (string [] args ){Int I = 0;Do {System. out. println (I );I ++;}
Explanation:
i equal to 0.
the Loop would run
i would increase by 1 the loop runs.
while i is less than, or equal to, 5, the loop would continue to run.
Conditions for continuing and terminating loops
Do-while () will be executed before you can make sure that the loop executes at least once.
Copy Code code as follows:
PS c:powershell> do {$n =read-host} while ($n-ne 0)
10
100
A loop in JavaScript is used to execute the same piece of code for a specified number of times (or when the specified condition is true).
JavaScript Switch Declaration
If you want to choose to execute one of several blocks of code, you can use the
Print? /* Start the comments in the program header (to avoid any problems encountered during the submission of blog posts, the slash used to indicate that the comments have been deleted)* Copyright and version Declaration of the program* All rights
While loopWhile loop while condition: if the condition is true, continue the loop if the condition is false, stop the loopLoop means to let the program repeatedly execute some statements, Whiler Loop is one of the loop structure, when the loop is
Check_user_login (); Check whether the user is logged in $db->createcon (); Establish a connection//$user =$_session["user"]; $user = "Libero"; The test temporarily uses//executes the User data table to select the user data $sql_
In a for loop, we can easily get the number of loops, because it appears as a condition. You can also obtain the following in the while statement:
It is occasionally used in actual work.
Write a program and use the while statement to calculate 1 + 1/2! + 1/3 !...... + 1/20 !, And output the computing results in the control of Taishan. Requirement 1 + 1/2! + 1/3 !...... + 1/20 !, In fact, it is to calculate 1 + 1*1/2 + 1*1/2*1/3 + ...
This example uses Python's while statement to brush its own blogNote: This function is only to show the powerful features of Python, not to attack anyone, let us be a citizen NetizenBring in the Python package you needImport WebBrowser as web as is
PHP//Total number of query information$db _num= Query_num ("table", "where 1=1");//number of bars to display per page $page _size=200; //Total number of entries $nums=$db _num; //Number of pages per display $sub _pages=5;
") Response. Write ("Use the Write method of the response object to output the content!") ")%> ") if a=100 then response. Write ("a=100, the first condition is satisfied.") ") ElseIf a=200 then Response. Write ("a=200, the second condition is
DeclareCursor Emp_cur is a SELECT * from EMP;V_emp Emp%rowtype;BeginOpen emp_cur;While Emp_cur%notfound--while must be used with the loop and control the loop body.LoopFetch emp_cur into v_emp;Dbms_output.put_line (V_emp.ename);
End Loop;Close emp_
Chapter 10 cyclic statements
10.1 WHILE LOOP
10.2 do... while loop
10.3 For Loop
10.3.1 three elements of cyclic conditions
10.3.2 the three elements are embodied in the For Loop Structure
10.4 multi-layer Loop
10.5 summary and a few
1. Cycle structure (i):Syntax: while (loop condition) {Looping operations}The following columns of code:int i=1;while (iSYSTEM.OUT.PRINTLN ("Study hard!! ");i=i+1;}2. What is the circular structure: from the above analysis, we can see that all the
Swift provides a similar control flow structure in all C languages. Includes for and while loops; if and switch conditional statements, break and continue jump statements, and so on.
Swift also joins the for-in Loop statement, making it easier for
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.