# [Ride v5] Union Functions
⚠️ This is the documentation for the Standard library version 5. We recommend to use version 6. Go to version 6
Name | Description | Complexity |
---|---|---|
isDefined(T|Unit): Boolean | Checks if an argument is not unit | 1 |
value(T|Unit): T | Gets a value from a union type argument. Fails if it is unit | 2 |
valueOrElse(T|Unit, T): T | Returns a value from a union type argument if it's not unit . Otherwise, returns the second argument | 2 |
valueOrErrorMessage(T|Unit, String): T | Gets a value from a union type argument if it's not unit . Otherwise, fails with the message specified in the second argument | 2 |
# isDefined(T|Unit): Boolean
Checks if an argument is not unit
.
isDefined(a: T|Unit): Boolean
Parameter | Description |
---|---|
a : T|Unit | Argument to check |
# value(T|Unit): T
Gets a value from a union type argument. Fails if it is unit.
value(a: T|Unit): T
Parameter | Description |
---|---|
a : T|Unit | Argument to return value from |
# valueOrElse(T|Unit, T): T
Returns a value from a union type argument if it's not unit. Otherwise, returns the second argument.
valueOrElse(t: T|Unit, t0: T): T
Parameter | Description |
---|---|
t : T|Unit | Argument to return value from |
t0 : T | Returned if t is unit |
# valueOrErrorMessage(T|Unit, String): T
Gets a value from a union type argument if it's not unit. Otherwise, fails with the message specified in the second argument.
valueOrErrorMessage(a: T|Unit, msg: String): T
Parameter | Description |
---|---|
a : T|Unit | Argument to return value from |
msg : String | Error message |