outrun/outrun-core/lib/greater_or_equal.outrun

22 lines
873 B
Text

use Any
use Boolean
use Greater
use Equality
```doc
# GreaterOrEqual
Values which implement the `>=` infix operator must implement this protocol.
If the value also implements the `Greater` and `Equality` protocols then this protocol can be automatically implemented.
```
protocol GreaterOrEqual, requires: Greater + Equality, as: do
```doc
Compare `self` and `other` returning a boolean.
The default implementation delegates to the `Greater` and `Equality` protocols, however you should probably implement this function as a single comparison is more than likely much faster.
```
def greater_or_equal?(self: Self, other: Any): Boolean, when: Greater.greater?(self, other), as: true
def greater_or_equal?(self: Self, other: Any): Boolean, when: Equality.equal?(self, other), as: true
def greater_or_equal?(_self: Self, _other: Any): Boolean, as: false
end