quit() Quit (alias of exit)
Last updated: 2026-09-22
quit() Quit (alias of exit)
quit() is an alias of exit(); also raises SystemExit.
| Category | Built-in Functions |
|---|---|
| Kind | Built-in Function |
| Python Version | all |
📝 Syntax
quit([code])
⚙️ Parameters
| code Optional | Exit code (int or None).(Default:None) |
|---|
Returns:Never returns: raises SystemExit (same as exit()).
💥 Raises
SystemExit— Always raised on call (the normal exit mechanism).
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
quit code: 1
🏷️ Related Built-in Functions
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QIs quit() exactly the same as exit()?
AYes — quit() is an alias of exit(), with identical SystemExit behavior and exit-code semantics.
QCan quit() exit a script normally?
AYes, but like exit() it is designed as an interactive tool; in a script, sys.exit(code) is recommended for clearer semantics.
QWhy do some people use quit and others exit?
APurely personal habit — they are fully equivalent; in the REPL both are actually objects provided by the site module and behave identically.
QWhat is the argument of quit(code) for?
AThe exit code: 0 means a normal exit and non-zero means an abnormal exit; an external process can judge the program's result from this value.