Silk

silk/bool

Named primitive Boolean equality and negation operations.

When to use

Prefer ==, !=, and ! in ordinary expressions. Import equals, notEquals, or not when an operation must be passed or selected by name.

Details

These functions return the same Boolean results as the operators. They allocate no storage and add no Effect channels.

Examples

Compose named Boolean operations

import silk.bool as Bool

pub fn main() -> i32 {
  let accepted = Bool.equals(true, Bool.not(false))
  if Bool.notEquals(accepted, true) {
    return 1
  }
  return 42
}

Import as bool with import silk.bool.

Public declarations: 3.

equals

pub fn equals(left: bool, right: bool) -> bool

Returns true when left and right have the same Boolean value.

notEquals

pub fn notEquals(left: bool, right: bool) -> bool

Returns true when left and right have different Boolean values.

not

pub fn not(value: bool) -> bool

Returns the logical negation of value.

On this page