+ 1

Who does while loop works

I didnot understand while loop

3rd Nov 2016, 10:17 AM
salus
5 Réponses
+ 1
You should really write your question in an understandable way. Without grammar or spelling errors cause like this it's hard to guess want your question is.
3rd Nov 2016, 10:39 AM
Waldemar Alexander Sulej
Waldemar Alexander Sulej - avatar
+ 1
"How" does while loop work? while condition: action action optional action to set condition False It repeats the indented block until the condition is False (or...'while' the condition is True). It can be a compound condition with more than one test, or even an inverted test: finished = False while !finished: #( not False .... = True) stuff more stuff if no_more_data: finished = True
6th Nov 2016, 8:37 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
repeats an action until a set condition is met
25th Dec 2016, 3:40 PM
Argwings Mutuli
Argwings Mutuli - avatar
0
I dont know php but while loops are the same in any language. while(condition){ Statements; } So for instance while(a<b){ //do something; a++; } So as long a is smaller than b the code will loop in the while loop. With a++ I increase the value of a by 1 for each loop. Once a is not smaller than b anymore the code outsidide the while loop will be executed. If you write a loop which you will never escape you have an endless loop which will cause your application to crash. So in an easy sentance: The while loop will execute until your condition is false.
3rd Nov 2016, 10:32 AM
Florian Schwarzer
0
when the condition is true
5th Nov 2016, 2:09 PM
Aymen Marine
Aymen Marine - avatar