|
|
|
|
|
by runarberg
2022 days ago
|
|
> > > We can’t perform arithmetic on an Option<int> any more than we could on a List<int>. Is actually kind of a weird point to make. There are number of ways to add together List<int> including: listA.zip(listB).map(([a, b]) => a + b);
Similarly adding together two optionals could be done with: optionalA.zip(optionalB).map(([a, b]) => a + b);
Or if you would rather: optionalA
.zip(optionalB)
.map(([a, b]) => a + b)
.or(optionalA)
.or(optionalB)
|
|