In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "which type of cycle javascript while belongs to". Friends who are interested may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn which type of cycle javascript while belongs to.
In javascript, while is a kind of equivalent loop statement, which needs to judge the loop condition first, then execute the loop body when the condition is satisfied, and jump out of the loop if it is not satisfied. The characteristic of while statement: judge the expression first, and execute the corresponding statement when the result of the expression is true.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
While loop statement is a kind of equivalent loop statement, which first judges the loop condition, executes the loop body when the condition is met, and stops when it is not satisfied.
Function: to perform an operation repeatedly until the specified condition is not established.
Features: first judge the expression, and execute the corresponding statement when the result of the expression is true.
The general form of a while loop is:
While (expression) {/ / expression is a circular conditional statement block; / / code block to be executed}
Statement parsing:
First evaluate the value of the "expression". When the value is true, execute the "statement block" in the loop.
Note: the evaluation result of the "expression" is of Boolean type (TRUE or FALSE). If it is a value of other types, it will be automatically converted to a value of Boolean type (because PHP is a weak language type, it will automatically convert the variable to the correct data type according to the value of the variable).
A statement block is a collection of one or more statements surrounded by {}; if there is only one statement in the statement block, {} can also be omitted.
After execution, return to the expression, evaluate the value of the expression again to judge, when the value of the expression is true, then continue to execute the "statement block". This process will be repeated all the time.
Do not jump out of the loop until the value of the expression is false and execute the statement below while.
The execution flow of the while loop is shown in the following figure:
Example: use a while loop to calculate the sum of all integers between 1 and 100:
Var iTunes 1 var sum=0;while (I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.