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 iff b0 and b1 are both either true or false .
71
72
73
74 val compare : bool -> bool -> int
75
76
77 compare b0 b1 is a total order on boolean values. false is smaller
78 than true .
79
80
81
82
83 Converting
84 val to_int : bool -> int
85
86
87 to_int b is 0 if b is false and 1 if b is true .
88
89
90
91 val to_float : bool -> float
92
93
94 to_float b is 0. if b is false and 1. if b is true .
95
96
97
98 val to_string : bool -> string
99
100
101 to_string b is "true" if b is true and "false" if b is false .
102
103
104
105
106
107OCamldoc 2020-09-01 Bool(3)