Skip to content

Commit

Permalink
Merge pull request #164 from Kevin-Lee/docs/either-isLeft
Browse files Browse the repository at this point in the history
Update: docs - `either.md`: add `isLeft`
  • Loading branch information
kevin-lee committed Dec 30, 2021
2 parents 8496d90 + 4a342e3 commit 8ab576b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions website/docs/types/either.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,22 @@ errorMsgOrNum2.isRight();
```

### `Either.isLeft`
To check if the `Either` is `Left`, use `isLeft()`,
```java
import j8plus.types.Either;

final Either<String, Integer> errorMsgOrNum = Either.right(999);
// Either<String, Integer> = Right(999)

errorMsgOrNum.isLeft();
// boolean = false

final Either<String, Integer> errorMsgOrNum2 = Either.left("Error message");
// Either<String, Integer> = Left(Error message)

errorMsgOrNum2.isLeft();
// boolean = true
```


### Example
Expand Down

0 comments on commit 8ab576b

Please sign in to comment.