object Result
- Companion:
- class
Type members
Value members
Concrete methods
Compare two arguments with the comparison function and return Result.success if the function return true. Otherwise, it returns Result.failure with the Log containing the argument values.
Compare two arguments with the comparison function and return Result.success if the function return true. Otherwise, it returns Result.failure with the Log containing the argument values.
- See also:
- Example:
val a1 = "abc" val a2 = "abc" Result.diff(a1, a2)(_ == _) // Result.success Result.diff(123, 456)(_ != _).log("It must be different.") // Result.success val x = 'q' val y = 80 Result.diff(x, y)((x, y) => y < 87 && x <= 'r') // Result.success
val a1 = "abc" val a2 = "xyz" Result.diff(a1, a2)(_ == _) // Result.failure > === Failed === > --- lhs --- > abc > --- rhs --- > xyz Result.diff(123, 123)(_ != _).log("It must be different.") // Result.failure > === Failed === > --- lhs --- > 123 > --- rhs --- > 123 > It must be different. val x = 'z' val y = 100 Result.diff(x, y)((x, y) => y < 87 && x <= 'r') // Result.failure > === Failed === > --- lhs --- > z > --- rhs --- > 100