xor abstract method

  1. @useResult
Option<T> xor(
  1. Option<T> other
)

Returns a Some if either, but not both, of this and other is a Some, or None otherwise.

Examples

// prints "None"
print(const Some(2).xor(const Some(3)));

// prints "Some(2)";
print(const Some(2).xor(const None()));

Implementation

@useResult
Option<T> xor(Option<T> other);