power_output
power_output

Reputation: 421

How to exit silently in OCaml, without exceptions

Suppose i'am deep in the stack and something happens and now i just want to exit. failwith won't do for me because it's not silent at all. I tried failwith "" and i got Fatal error: exception Failure("") I need something similar to exit 0 in C.

Upvotes: 0

Views: 643

Answers (1)

Jeffrey Scofield
Jeffrey Scofield

Reputation: 66823

You can do this:

exit 0

It works exactly like exit(0); in C.

The most basic operations like this are in the Pervasives module. Every time I read through the Pervasive docs I notice something I forgot since the previous time.

Upvotes: 3

Related Questions