effect-io-ai

Package: effect
Module: Boolean

Boolean.xor

Combines two booleans using XOR: (!self && that) || (self && !that).

When to use

Use to accept when exactly one boolean operand is true.

Example (Combining booleans with XOR)

import { Boolean } from "effect"
import * as assert from "node:assert"

assert.deepStrictEqual(Boolean.xor(true, true), false)
assert.deepStrictEqual(Boolean.xor(true, false), true)
assert.deepStrictEqual(Boolean.xor(false, true), true)
assert.deepStrictEqual(Boolean.xor(false, false), false)

Signature

declare const xor: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean; }

Source

Since v2.0.0