0

About break statement

I'm currently making a program, but the break statement doesn't work, I want to make my python program end if user inputs "quit", here is the code : if user_input == "quit": break When trying to run it, it says break is outside loop. Help :c

13th Jun 2017, 7:15 PM
Scuram
2 Answers
+ 2
use quit() or import sys sys.exit() break is used for stopping a loop. It does not stop the program itself.
13th Jun 2017, 7:18 PM
Sapphire
+ 1
Wow thanks for fast answer, it worked :D
13th Jun 2017, 7:20 PM
Scuram