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#
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#
pub fn equals(left: bool, right: bool) -> boolReturns true if left and right have the same value. This function has the same result as
left == right.
notEquals#
pub fn notEquals(left: bool, right: bool) -> boolReturns true if left and right have different values. This function has the same result
as left != right.
not#
pub fn not(value: bool) -> boolReturns 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.