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
1. 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 every week, 3 meals a day, and 50 copies of each
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
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.
C # loop statement: while LOOP and for loop (1 ),
For example, if we want to output hundreds of numbers when doing a lot of things, one output is not only troublesome, but also time-consuming and inefficient. At this time, C # provides us with a
Java cyclic statements-general Linux technology-Linux programming and kernel information. The following is a detailed description. Java loop statements include for, while, and do-while. These statements create what we usually call a loop (loops ).
In our program development, it may be necessary to repeat the use of a piece of code or a function, such as the need to enter "1*2*3*4...*100", if the human input, it will waste a lot of time, but also very cumbersome, but in this case, there is a
Using the While loopYou can use the while loop to count.1 while 5 : print (current_number) 1Let the user choose when to exitYou can use the while loop to keep the program running as the user wishes. prompt = " \ntell Me Something, and I'll
We now know how to use the IF statement to get the program to run along a different path, but the best thing about the program is to use the CPU and GPU's powerful execution to repeatedly execute a piece of code, think of Google's Alphago and Ke Jie'
[Code optimization] for-each replaces the common for loop or while LOOP, for-eachwhile
The preferred method for traversing a set is for-each.
for(Element e :c){ doSomething(e);}
This is the practice after version 1.5; before Java, the Iterator
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.