And

public protocol And[Other = Self]

Raw protocol backing the and keyword operator.

The other operand is a thunk so that conformers can short-circuit: the right-hand side must not be evaluated when self is falsy. The stdlib implementations on Bool and the optional types all honour this; user implementations should too.

Examples

true and false // false true and { true } // true (closure form, mostly internal)

Associated Types

type Output

Methods

func logicalAnd(() -> Other) -> Output

Returns self and other(). The closure runs only if needed.

Defined in lang/std/core/logical.ks