Day 4: loop structure (while, do... While, ),... While1. Loop Structure (while, do... While,)
1.1. What is a loop structure
In daily life, there will be a lot of things that need to be done repeatedly, such as four seasons of every year, 7 days of
4.3 Loop control statementsIn the real world, there is such a phenomenon:As long as the current oil in the tank is less than the tank capacity of 100 liters, the fuel tank has been refueling;has been continuously for the motherland hard work, as
4.3 Loop control statementsIn the real world, there is such a phenomenon:As long as the current oil in the tank is less than the tank capacity of 100 liters, the fuel tank has been refueling;has been continuously for the motherland hard work, as
While statementexecutes the statement repeatedly until the expression evaluates to zero.Grammar
while (expression)
statement
NoteThe expression test occurs before each loop execution, so the while loop executes 0 or more times. An
ForeachPhp Tutorial 4 (not php 3) includes the foreach structure, which is similar to perl and other languages. This is just a simple way to traverse arrays. Foreach can only be used for arrays. An error occurs when you try to use it for another
If, while usage differences in different languagesIf, while, and other branch loop structures inherit the external scope, that is, the external variables are visible inside the branch loop structure.However, the C language does not support the
Using Do-while statements to form loopsThe Do-while statement is characterized by executing the loop body first, and then judging whether the cyclic condition is tenable. Its general form is:
Do
statement while
(expression);
It
Let me introduce you to the loop execution for loop in C #
In this practice, we'll show you another important circular statement in C #, for loops.
for (expression 1; expression 2; expression 3)
{
loop-body
}
Expression 1: Generally
Mutual reference between C and C ++ functions extern "C" for an in-depth understanding
1. Introduction
C ++ language was originally created as "a better C ", however, this does not mean that the compilation and connection methods used by global
A Bash Script: A while loop in the Loop Structure
Like other languages, the Bash loop structure also contains the while statement.Basic Structure
While condition do loop body done
Like the for statement, its loop body is also do... Done structure.
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.