and<R> method
Returns other when this result succeeded, or this error otherwise.
other is evaluated before the call. Use andThen when the next result
needs the value or is expensive to build.
final next = const Ok<int, String>(1).and(const Ok<String, String>('a'));
Implementation
Result<R, E> and<R>(Result<R, E> other) {
return switch (this) {
Ok<T, E>() => other,
Err<T, E>(:final error) => Err<R, E>(error),
};
}