While loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

While loop

Guys Please i need a simplified explanation of a while loop

10th Mar 2021, 3:07 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
23 Answers
+ 13
It keeps repeating until condition becomes false.
10th Mar 2021, 3:51 PM
Gordon
Gordon - avatar
+ 6
Hi! This topic is covered in Lesson 19.1 of your JavaScript course. please be diligent
10th Mar 2021, 3:29 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 5
Kwabena Karikari Affum x = 24; while (x >= 0) { document.write(x," "); x -= 1; }
10th Mar 2021, 4:45 PM
BroFar
BroFar - avatar
+ 4
Unlike do-while loop, while loop will enter the body only if condition is satisfied and performs increment operation inside the loop body unlike for loop. While loop will repeat itself until the condition becomes false.
11th Mar 2021, 6:55 PM
Shaista Sid 🌸
Shaista Sid 🌸 - avatar
+ 3
This is similar to for loop. The condition is in brackets.
10th Mar 2021, 5:16 PM
JaScript
JaScript - avatar
+ 2
If the condition is true it goes to next statement. When it becomes false then it Reactedley check the condition
11th Mar 2021, 5:46 PM
Neeraj Salehittal
Neeraj Salehittal - avatar
+ 1
BroFar I don't need example whiles I don't know it man
10th Mar 2021, 4:48 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
+ 1
Kwabena Karikari Affum the easiest way to learn is by examples. As Gordon and Ярослав Вернигора(Yaroslav Vernigora) mentioned. in my example: while ( condition ) { do this until condition is met; } while ( True ) { do this until condition is met; } while ( False ) { do this until condition is met; }
10th Mar 2021, 5:26 PM
BroFar
BroFar - avatar
+ 1
please provide a sample code that you don't understand with this loop or something else... otherwise, go learn your course from the very beginning and ask only in substance, with concrete examples. no abstract explanations will help you until you try and feel it yourself
10th Mar 2021, 5:32 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
well, sometimes we just some work till a certain condition is met, for example > i will watch telivision for 1 hr .. It just means you will watch tv until 1hr is passed ... so ,tv is in our loop ...like this while(not 1hr passed) { watch TV } as 1hr passed you can see ( not 1hr passed) become false ,as 1hr is passed... it just means, you won't be watching tv now OR JUST end THE LOOP STUFF...
12th Mar 2021, 3:43 PM
000
000 - avatar
0
Actually I'm learning while loop at mimo I just want to be at for loop in mimo and at the same time at sololearn
10th Mar 2021, 5:20 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
0
Brofar DM me on it please I still don't get it
10th Mar 2021, 5:27 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
0
While loop repeats the block of code until the condition stays true
11th Mar 2021, 12:24 PM
Parveen Rai
Parveen Rai - avatar
0
Oroob mustapha what are you talking about
12th Mar 2021, 9:05 AM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
12th Mar 2021, 12:29 PM
000
000 - avatar
0
000 it's plenty
12th Mar 2021, 2:55 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
0
might you got it now ^_^
12th Mar 2021, 2:57 PM
000
000 - avatar
0
Put them all in a nutshell
12th Mar 2021, 2:58 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
0
Thanks
12th Mar 2021, 3:47 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
0
would you get it •_• ???
12th Mar 2021, 3:48 PM
000
000 - avatar