Is there a way to make the input "Quit" break out of the while loop rather than restart it? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Is there a way to make the input "Quit" break out of the while loop rather than restart it?

https://code.sololearn.com/W4tRgMj0xNJn/?ref=app

25th Mar 2018, 12:51 PM
Name
6 ответов
+ 1
Add a variable called “hasQuit” equal to false. Put it to true when the user presses quit. At the end of the while loop, have an if statements checking if hasQuit is true. If it is, break again.
25th Mar 2018, 9:41 PM
Ariela
Ariela - avatar
+ 1
Yes
26th Mar 2018, 1:20 AM
Ariela
Ariela - avatar
0
You could use return; if it’s the end of the function
25th Mar 2018, 1:15 PM
Ariela
Ariela - avatar
0
Unfortunately, there is no function in question, however.
25th Mar 2018, 7:42 PM
Name
0
I want to break out of a while loop while in a smaller switch statement whithin the loop. When I use break, it breaks out of the switch statement.
25th Mar 2018, 7:44 PM
Name
0
can you assign boolean values to variables?
26th Mar 2018, 12:46 AM
Name