1#Exit everywhere with error message
2import sys
3sys.exit("Code not Pythonical")
4
5#Exit with a specific status
6import os
7os._exit()
8
9#Exit in interpreter
10quit()
11
12#Exit in Interpreter but more user friendly
13exit()
1#Just do return
2quit = True
3
4def example():
5 if quit:
6 return
7
8print(example())
9#Doesnt output anything
10
11#Or if you want an out put from the function
12
13def example2():
14 return (1+1)
15
16print(example2())
17
18#Outputs 2