You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
final result =match<num, num>(2)
.on((x) => x <0, () =>0)
.on((x) => x >=0&& x <=1, () =>1)
.otherwise((x) => x*10);
i'm not necessarily recommending this approach and i wouldn't claim that it's more "functional" than side effect free functions with normal conditionals/switches in them, but it's an interesting use case!
I was looking for a functional alternative and I found
mach
Is there something similar in dartz?
https://codeburst.io/alternative-to-javascripts-switch-statement-with-a-functional-twist-3f572787ba1c
The text was updated successfully, but these errors were encountered: