On Thursday 09 August 2007 18:58:24 cugf_0956 wrote:
> I see a lot of examples using "assert" and I kind of understand what
> it does but I couldn't find any documentation that precisely describe
> what assert shall and can do, I certainly can not find it in the
> Standard Library and tutorials. Please enlighten me.
It throws the Assert_failure exception if the given value is false:
# assert true;;
- : unit = ()
# assert false;;
Exception: Assert_failure ("", 1, 0).
its definition might be:
# let assert b = if not b then raise (Assert_failure("", 0, 0));;
val assert : bool -> unit = <fun>
except that the exception contains the line and character of the assert in the
source code.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e
.