0

Loop

what is the difference between while and repeat-while

30th Oct 2018, 4:11 PM
Feres
Feres - avatar
3 Answers
+ 2
My bad you're right Kishalaya Saha Then maybe he should check this lesson and comments https://www.sololearn.com/learn/Swift/2341/
30th Oct 2018, 5:05 PM
Uni
Uni - avatar
+ 2
A case where I would use repeat while/do while is when I don't have the means to form my while-condition yet. For example I want the user to choose between 'y' and 'n'. If he/she types anything else, I want to loop. But initially I have nothing to check - the user needs to input first! So I'd start with... do { ... here I take the input... } while (input != 'y' || input!= 'n');
30th Oct 2018, 11:37 PM
HonFu
HonFu - avatar
0
I think in some languages (Swift?) the do-while loop is called repeat-while.
30th Oct 2018, 5:03 PM
Kishalaya Saha
Kishalaya Saha - avatar