While loop | Sololearn: Learn to code for FREE!

+4

While loop

Guys Please i need a simplified explanation of a while loop

3/10/2021 3:07:21 PM

Kwabena Karikari Affum

23 Answers

New Answer

+11

It keeps repeating until condition becomes false.

+5

Hi! This topic is covered in Lesson 19.1 of your JavaScript course. please be diligent

+5

Kwabena Karikari Affum x = 24; while (x >= 0) { document.write(x," "); x -= 1; }

+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.

+3

This is similar to for loop. The condition is in brackets.

+2

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; }

+2

If the condition is true it goes to next statement. When it becomes false then it Reactedley check the condition

+1

BroFar I don't need example whiles I don't know it man

+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

+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...

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

0

Brofar DM me on it please I still don't get it

0

While loop repeats the block of code until the condition stays true

0

Oroob mustapha what are you talking about

0

https://code.sololearn.com/WWDtEFuHA13T/?ref=app well may this could help...

0

000 it's plenty

0

might you got it now ^_^

0

Put them all in a nutshell

0

0

would you get it •_• ???