Browse the docs

silk.core.bool.

Named functions for Boolean equality and negation.

When to use#

Use ==, !=, and ! in ordinary expressions. Use equals, notEquals, or not when the operation must be a named function, such as an argument to a higher-order function.

Details#

These functions return the same results as the operators. They do not allocate and have no effects.

Examples#

Compose named Boolean operations#

silk
import silk.core.bool

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

Import as bool with import silk.core.bool.

Public declarations: 3.

equals#

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

Returns true if left and right have the same value. This function has the same result as left == right.

notEquals#

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

Returns true if left and right have different values. This function has the same result as left != right.

not#

silk
pub fn not(value: bool) -> bool

Returns false if value is true, and true if value is false. This function has the same result as !value.

Category: Core.

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2.

View the source of this page