std.bool.Bool
Valuetype pub builtin BoolThe class for boolean true and false.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: ref Self) -> Bool {
  (self == other).false?
}fn pub !=(other: ref Self) -> BoolReturns true if self and the given object are not equal to each other.
<
Show source codeHide source code
fn pub <(other: ref Self) -> Bool {
  match cmp(other) {
    case Less -> true
    case _ -> false
  }
}fn pub <(other: ref Self) -> BoolReturns true if self is lower than the given argument.
<=
Show source codeHide source code
fn pub <=(other: ref Self) -> Bool {
  match cmp(other) {
    case Less or Equal -> true
    case _ -> false
  }
}fn pub <=(other: ref Self) -> BoolReturns true if self is lower than or equal to the given argument.
==
Show source codeHide source code
fn pub inline ==(other: ref Bool) -> Bool {
  _INKO.bool_eq(self, other)
}fn pub inline ==(other: Bool) -> BoolReturns true if self and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
>
Show source codeHide source code
fn pub >(other: ref Self) -> Bool {
  match cmp(other) {
    case Greater -> true
    case _ -> false
  }
}fn pub >(other: ref Self) -> BoolReturns true if self is greater than the given argument.
>=
Show source codeHide source code
fn pub >=(other: ref Self) -> Bool {
  match cmp(other) {
    case Greater or Equal -> true
    case _ -> false
  }
}fn pub >=(other: ref Self) -> BoolReturns true if self is equal to or greater than the given argument.
clone
Show source codeHide source code
fn pub inline clone -> Bool {
  self
}fn pub inline clone -> BoolCreates a clone of self.
The returned value is an owned value that is the same type as the receiver
of this method. For example, cloning a ref Array[Int] results in a
Array[Int], not another ref Array[Int].
cmp
Show source codeHide source code
fn pub inline cmp(other: ref Bool) -> Ordering {
  to_int.cmp(other.to_int)
}fn pub inline cmp(other: Bool) -> OrderingReturns the ordering between self and the given argument.
The returned value should be as follows:
a == b:Ordering.Equala > b:Ordering.Greatera < b:Ordering.Less
false?
Show source codeHide source code
fn pub inline false? -> Bool {
  self == false
}fn pub inline false? -> BoolReturns true if self is false.
Examples
true.false?  # => false
false.false? # => true
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
  if self { formatter.write('true') } else { formatter.write('false') }
}fn pub fmt(formatter: mut Formatter)Formats self in a human-readable format for debugging purposes.
hash
Show source codeHide source code
fn pub inline hash[H: mut + Hasher](hasher: mut H) {
  hasher.write(to_int)
}fn pub inline hash[H: mut + Hasher](hasher: mut H: mut)Writes the hash for self into the given Hasher.
then
Show source codeHide source code
fn pub inline then[T](func: fn -> T) -> Option[T] {
  if self { Option.Some(func.call) } else { Option.None }
}fn pub inline then[T](func: fn -> T) -> Option[T]Calls the supplied closure and wraps its return value in a Some if self
is true, otherwise returns a None.
Examples
true.then(fn { 10 })  # => Option.Some(10)
false.then(fn { 10 }) # => Option.None
to_int
Show source codeHide source code
fn pub inline to_int -> Int {
  self as Int64 as Int
}fn pub inline to_int -> IntConverts self to a Int
to_string
Show source codeHide source code
fn pub inline to_string -> String {
  if self { 'true' } else { 'false' }
}fn pub inline to_string -> StringConverts self to a String.
true?
Show source codeHide source code
fn pub inline true? -> Bool {
  self
}fn pub inline true? -> BoolReturns true if self is true.
Examples
true.true?  # => true
false.true? # => false
Implemented traits
Clone
impl Clone for BoolCompare
impl Compare for BoolEqual
impl Equal for BoolFormat
impl Format for BoolHash
impl Hash for BoolToInt
impl ToInt for BoolToString
impl ToString for Bool