Iterate
Apply the given function to Either<TLeft, TRight>
value according to its state.
Parameters
Returns
Action<TRight> actionWhenRight
Action<TRight> actionWhenLeft
Either<TLeft, TRight> either
void
Usage
This function is an alternative to Map
functions to apply an Action
rather a Func
delegate.
When Either IsRight
When Either IsLeft
One sided approach
You can also use the IterateLeft
and IterateRight
to produce the same results, but with these methods the action is applied just to one of the possible values.
When the target type is different from Either
current value the function will creates an Unit
value.
IterateLeft when Either IsRight
IterateLeft when Either IsLeft
Last updated
Was this helpful?