Skip to content

std/bool

Import with import std/bool.

type True

Singleton type representing the boolean true value; a variant of Bool.

fn inspect(value: True): String

impl Debug.inspect

fn compare(a: True, b: True): Ordering

impl Comparable.compare

fn to_string(value: True): String

impl Display.to_string

fn equal?(a: True, b: True): Bool

impl Equatable.equal?

fn hash(value: True): Int

impl Hashable.hash

type False

Singleton type representing the boolean false value; a variant of Bool.

fn inspect(value: False): String

impl Debug.inspect

fn compare(a: False, b: False): Ordering

impl Comparable.compare

fn to_string(value: False): String

impl Display.to_string

fn equal?(a: False, b: False): Bool

impl Equatable.equal?

fn hash(value: False): Int

impl Hashable.hash

enum Bool {
    embeds False
    embeds True
}

Boolean enum with True and False variants.

Interactive Tests

assert True == True
refute True == False
fn inspect(value: Bool): String

impl Debug.inspect

fn compare(a: Bool, b: Bool): Ordering

impl Comparable.compare

fn to_string(value: Bool): String

impl Display.to_string

fn equal?(a: Bool, b: Bool): Bool

impl Equatable.equal?

fn hash(value: Bool): Int

impl Hashable.hash