when does a while loop end normally? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

when does a while loop end normally?

Leaving a blank line will end a loop?

5th Aug 2016, 4:24 PM
Mr.Robot
Mr.Robot - avatar
3 ответов
+ 3
Nope a while loop is going so long until the code after while isnt true anymore for example: i = 1 while i <=5: print(i) i = i + 1 so i starts with being 1 and the while loop is saying: "Im printing while i is smaller then 5" So that means when i is bigger than 5 it stops looping. and the loop said print i and i= i + 1 so the output is : 1 2 3 4 5 and then the while loop stops cause the while loop said it only loops when 5 is bigger then i . My English isn't very good but i hope i helped you out a bit.
5th Aug 2016, 6:20 PM
JSon
+ 1
In C , C++ You may know that while {..} in between the curly braces we can provide the statements. but while here how I can declare statements for while loop ..
6th Aug 2016, 3:31 AM
Mr.Robot
Mr.Robot - avatar
0
while expression: statement(s)
6th Aug 2016, 8:28 AM
JSon