Skip to main content

Bool

Booleans are either true or false.

let succeeded = true

Functions

And

The logical AND of two boolean values. Returns a bool.

Truth Table

XYAND(X,Y)
falsefalsefalse
falsetruefalse
truefalsefalse
truetruetrue

Definition

Bool.and(Bool, Bool) -> Bool

Examples

let x = true
let y = false
Bool.and x y

This trace returns: false

let x = [false,false,true,true]
let y = [false,true,false,true]
List.map2 x y \a, b -> Bool.and a b

This trace returns: [ false, false, false, true ]

Shorthand: &&

A double ampersand provides an inline shortcut for Bool.and(). Note that this operator is lazy (the right hand term is only evaluated if the left hand term does not determine the result)

Example

let x = true
let y = false
x && y

This trace returns: false


OR

The logical OR of two boolean values. Returns a bool.

Truth Table

XYOR(X,Y)
falsefalsefalse
falsetruetrue
truefalsetrue
truetruetrue

Definition

Bool.or(Bool, Bool) -> Bool

Examples

let x = true
let y = false
Bool.or x y

This trace returns: true

let x = [false,false,true,true]
let y = [false,true,false,true]
List.map2 x y \a, b -> Bool.or a b

This trace returns: [ false, true, true, true ]

Shorthand: ||

A double vertical pipe provides an inline shortcut for Bool.or(). Note that this operator is lazy (the right hand term is only evaluated if the left hand term does not determine the result)

Example

let x = true
let y = false
x || y

This trace returns: true


NOT

The logical NOT of a boolean value. Returns a bool.

Truth Table

XNOT(X)
falsetrue
truefalse

Definition

Bool.not(Bool, Bool) -> Bool

Examples

let x = true
Bool.not x

This trace returns: false

let x = [false,true]
List.map x \a -> Bool.not a

This trace returns: [ true, false ]


XOR

The logical exclusive OR of two boolean values. Returns a bool.

Truth Table

XYXOR(X,Y)
falsefalsefalse
falsetruetrue
truefalsetrue
truetruefalse

Definition

Bool.xor(Bool, Bool) -> Bool

Examples

let x = true
let y = false
Bool.xor x y

This trace returns: true

let x = [false,false,true,true]
let y = [false,true,false,true]
List.map2 x y \a, b -> Bool.xor a b

This trace returns: [ false, true, true, false ]


ToString

Returns the value of the variable as a string.

Definition

Bool.toString(Bool) -> String

Examples

let x = true
Bool.toString x

This trace returns: "true"

Bool.toString false

This trace returns: "false"