Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. void main() {
  2. Either<String,double> safeDivision(int a, int b) => (b==0) ? Left("Invalid") : Right(a/b);
  3.  
  4. final Either<String,double> a = safeDivision(2, 0); // Left("Invalid)
  5. final Either<String,double> b = safeDivision(4, 2); // Right(2)
  6. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement