0
Loop
what is the difference between while and repeat-while
3 Réponses
+ 2
My bad you're right Kishalaya Saha
Then maybe he should check this lesson and comments
https://www.sololearn.com/learn/Swift/2341/
+ 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');
0
I think in some languages (Swift?) the do-while loop is called repeat-while.