abstract struct Number

Overview

The top-level number type.

Included Modules

Defined in:

what_happen/extension.cr

Instance Method Summary

Instance methods inherited from class Object

<=>(other) <=>, what_happen?(expect) : Array(String) what_happen?

Instance Method Detail

def <=>(other) : Int32 | Nil #

The comparison operator.

Returns:

  • -1 if self is less than other
  • 0 if self is equal to other
  • 1 if self is greater than other
  • nil if self is NaN or other is NaN, because NaN values are not comparable

[View source]