man-pages/man3/Bool.3o.html
2021-03-31 01:06:50 +01:00

327 lines
3.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Bool</TITLE>
</HEAD><BODY>
<H1>Bool</H1>
Section: OCaml library (3o)<BR>Updated: 2020-01-30<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Bool - Boolean values.
<A NAME="lbAC">&nbsp;</A>
<H2>Module</H2>
Module Bool
<A NAME="lbAD">&nbsp;</A>
<H2>Documentation</H2>
<P>
Module
<B>Bool</B>
<BR>&nbsp;:&nbsp;
<B>sig end</B>
<P>
<P>
Boolean values.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<P>
<P>
<P>
<P>
<A NAME="lbAE">&nbsp;</A>
<H3>Booleans</H3>
<P>
<P>
<I>type t </I>
=
<B>bool</B>
=
<BR>&nbsp;|&nbsp;false
<BR>&nbsp;|&nbsp;true
<BR>&nbsp;
<P>
The type of booleans (truth values).
<P>
The constructors
<B>false</B>
and
<B>true</B>
are included here so that they have
paths, but they are not intended to be used in user-defined data types.
<P>
<P>
<P>
<I>val not </I>
:
<B>bool -&gt; bool</B>
<P>
<P>
<B>not b</B>
is the boolean negation of
<B>b</B>
.
<P>
<P>
<P>
<I>val (&amp;&amp;) </I>
:
<B>bool -&gt; bool -&gt; bool</B>
<P>
<P>
<B>e0 &amp;&amp; e1</B>
is the lazy boolean conjunction of expressions
<B>e0</B>
and
<B>e1</B>
.
If
<B>e0</B>
evaluates to
<B>false</B>
,
<B>e1</B>
is not evaluated. Right-associative
operator at precedence level 3/11.
<P>
<P>
<P>
<I>val (||) </I>
:
<B>bool -&gt; bool -&gt; bool</B>
<P>
<P>
<B>e0 || e1</B>
is the lazy boolean disjunction of expressions
<B>e0</B>
and
<B>e1</B>
.
If
<B>e0</B>
evaluates to
<B>true</B>
,
<B>e1</B>
is not evaluated. Right-associative
operator at precedence level 2/11.
<P>
<P>
<P>
<P>
<A NAME="lbAF">&nbsp;</A>
<H3>Predicates and comparisons</H3>
<P>
<P>
<P>
<I>val equal </I>
:
<B>bool -&gt; bool -&gt; bool</B>
<P>
<P>
<B>equal b0 b1</B>
is
<B>true</B>
iff
<B>b0</B>
and
<B>b1</B>
are both either
<B>true</B>
or
<B>false</B>
.
<P>
<P>
<P>
<I>val compare </I>
:
<B>bool -&gt; bool -&gt; int</B>
<P>
<P>
<B>compare b0 b1</B>
is a total order on boolean values.
<B>false</B>
is smaller
than
<B>true</B>
.
<P>
<P>
<P>
<P>
<A NAME="lbAG">&nbsp;</A>
<H3>Converting</H3>
<P>
<P>
<P>
<I>val to_int </I>
:
<B>bool -&gt; int</B>
<P>
<P>
<B>to_int b</B>
is
<B>0</B>
if
<B>b</B>
is
<B>false</B>
and
<B>1</B>
if
<B>b</B>
is
<B>true</B>
.
<P>
<P>
<P>
<I>val to_float </I>
:
<B>bool -&gt; float</B>
<P>
<P>
<B>to_float b</B>
is
<B>0.</B>
if
<B>b</B>
is
<B>false</B>
and
<B>1.</B>
if
<B>b</B>
is
<B>true</B>
.
<P>
<P>
<P>
<I>val to_string </I>
:
<B>bool -&gt; string</B>
<P>
<P>
<B>to_string b</B>
is
<B>true</B>
if
<B>b</B>
is
<B>true</B>
and
<B>false</B>
if
<B>b</B>
is
<B>false</B>
.
<P>
<P>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">Module</A><DD>
<DT id="3"><A HREF="#lbAD">Documentation</A><DD>
<DL>
<DT id="4"><A HREF="#lbAE">Booleans</A><DD>
<DT id="5"><A HREF="#lbAF">Predicates and comparisons</A><DD>
<DT id="6"><A HREF="#lbAG">Converting</A><DD>
</DL>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:36 GMT, March 31, 2021
</BODY>
</HTML>