struct Bool
inherits Value
¶
Bool has only two possible values: true
and false
. They are constructed using these literals:
true # A Bool that is true
false # A Bool that is false
Class methods¶
Methods¶
#&(other : Bool) : Bool
¶
(other : Bool) : Bool
Bitwise AND. Returns true
if this bool and other are true
, otherwise returns false
.
false & false # => false
false & true # => false
true & false # => false
true & true # => true
#^(other : Bool) : Bool
¶
(other : Bool) : Bool
Exclusive OR. Returns true
if this bool is different from other, otherwise returns false
.
false ^ false # => false
false ^ true # => true
true ^ false # => true
true ^ true # => false
#to_unsafe : LibC::Int
¶
: LibC::Int
Returns an integer derived from the boolean value, for interoperability with C-style booleans.
The value is 1
for true
and 0
for false
.
#|(other : Bool) : Bool
¶
(other : Bool) : Bool
Bitwise OR. Returns true
if this bool or other is true
, otherwise returns false
.
false | false # => false
false | true # => true
true | false # => true
true | true # => true