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