outrun/outrun-core/lib/greater_or_equal.outrun

23 lines
873 B
Text
Raw Normal View History

2022-08-19 16:25:42 +12:00
use Any
use Boolean
use Greater
use Equality
2022-08-04 17:38:00 +12:00
```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
2022-08-04 17:38:00 +12:00
```doc
Compare `self` and `other` returning a boolean.
2022-08-04 17:38:00 +12:00
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.
```
2022-08-19 16:25:42 +12:00
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
2022-08-04 17:38:00 +12:00
end