414
you are viewing a single comment's thread
view the rest of the comments
[-] lowleveldata@programming.dev 5 points 2 years ago

I have never used System.exit() or sys.exit(). What is a use case where you would call these explicitly?

[-] niq@discuss.tchncs.de 24 points 2 years ago* (last edited 2 years ago)

For example if you want to set an explicit exit code. Calling python scripts will usually result in an exit code 0 after the script is run. If you want to set a different exit code for example 1 to indicate some error occured you can do that via sys.exit(1).

Same thing applies to other languages of course.

load more comments (3 replies)
this post was submitted on 25 Jun 2023
414 points (100.0% liked)

Programmer Humor

33755 readers
217 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS