1Bool(3) OCaml library Bool(3)
2
3
4
6 Bool - Boolean values.
7
9 Module Bool
10
12 Module Bool
13 : sig end
14
15
16 Boolean values.
17
18
19 Since 4.08
20
21
22
23
24
25
26
27 Booleans
28 type t = bool =
29 | false
30 | true
31
32
33 The type of booleans (truth values).
34
35 The constructors false and true are included here so that they have
36 paths, but they are not intended to be used in user-defined data types.
37
38
39
40 val not : bool -> bool
41
42
43 not b is the boolean negation of b .
44
45
46
47 val (&&) : bool -> bool -> bool
48
49
50 e0 && e1 is the lazy boolean conjunction of expressions e0 and e1 . If
51 e0 evaluates to false , e1 is not evaluated. Right-associative operator
52 at precedence level 3/11.
53
54
55
56 val (||) : bool -> bool -> bool
57
58
59 e0 || e1 is the lazy boolean disjunction of expressions e0 and e1 . If
60 e0 evaluates to true , e1 is not evaluated. Right-associative operator
61 at precedence level 2/11.
62
63
64
65
66 Predicates and comparisons
67 val equal : bool -> bool -> bool
68
69
70 equal b0 b1 is true if and only if b0 and b1 are both true or both
71 false .
72
73
74
75 val compare : bool -> bool -> int
76
77
78 compare b0 b1 is a total order on boolean values. false is smaller
79 than true .
80
81
82
83
84 Converting
85 val to_int : bool -> int
86
87
88 to_int b is 0 if b is false and 1 if b is true .
89
90
91
92 val to_float : bool -> float
93
94
95 to_float b is 0. if b is false and 1. if b is true .
96
97
98
99 val to_string : bool -> string
100
101
102 to_string b is "true" if b is true and "false" if b is false .
103
104
105
106
107
108OCamldoc 2023-01-23 Bool(3)