Skip to main content
Log in

Mojo trait

EqualityComparable

A type which can be compared for equality with other instances of itself.

Implemented traits

AnyType, UnknownDestructibility

Methods

__eq__

__eq__(self: _Self, other: _Self) -> Bool

Define whether two instances of the object are equal to each other.

Args:

  • other (_Self): Another instance of the same type.

Returns:

True if the instances are equal according to the type's definition of equality, False otherwise.

__ne__

__ne__(self: _Self, other: _Self) -> Bool

Define whether two instances of the object are not equal to each other.

Args:

  • other (_Self): Another instance of the same type.

Returns:

True if the instances are not equal according to the type's definition of equality, False otherwise.