SplitScript reference / Equatable / equals

Equatable.equals

Operator

Self.equals(other: Self) -> bool where Self: Equatable

Reports whether this value and another value are equal.

This method is also the implementation of the == operator. Structs, enums, arrays, options, and results compare their complete structure; strings compare UTF-8 contents. Array equality compares lengths and then elements in order. Floating-point equality follows IEEE 754, so NaN is not equal to itself.

Parameters

  • other: The other value of the same type.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Compare two state values

let unchanged = 4u32 == 4u32