I want to be able to end my program after I run at any point of time. Similar to how I press ctrl + c and it says keyboard interrupt but I don't want something like
if "keyboard press here" == true:
quit()
the reason I don't want it to be like above is because it seems that my code will run until it reaches this part of my code. Is there a command
edit:
Sorry, if I'm not clear on my question. What I mean is that I don't want my program to have to reach the point of where it says "press keyboard to quit" in my program but to have it in every space. so for example if I have a while loop that looks something like this:
while True
print "1"
print "2"
if "keyboard press here" == true:
quit()
print "3"
print "4"
I'd have to wait till it prints out
>>>1
>>>2
before it I can press my keyboard to stop or if it passes 2 and goes to print 3 it'd look like this
>>>1
>>>2
>>>3
>>>4
>>>1
>>>2
and then my program will stop.
I'd like to have my program work like this:
while True
print "1"
if "keyboard press here" == true:
quit()
print "2"
if "keyboard press here" == true:
quit()
print "3"
if "keyboard press here" == true:
quit()
print "4"
if "keyboard press here" == true:
quit()
but I don't want to keep putting
if "keyboard press here" == true: quit()
every other space. Is there a way to do that?