Skip to content

Commit

Permalink
Update README: add example of usage as library
Browse files Browse the repository at this point in the history
  • Loading branch information
Ro5bert committed Oct 2, 2019
1 parent a7598db commit 5aecfc3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,18 @@ $ vera tt '!!!(p>q)|r'
</pre>-->

<img src="sampleCLIOutput.png" alt="Sample CLI Output" width="300" />

### Use as a Library Example

```go
// Assuming "github.com/Ro5bert/vera" is imported

stmt, truth, err := vera.Parse("a > b")
if err != nil {
// handle error
}
// Iterate over all sets of truth values and print out the stmt evaluated at each set:
for ; truth.Val < (1 << len(truth.Names)); truth.Val++ {
fmt.Println(stmt.Eval(truth))
}
```

0 comments on commit 5aecfc3

Please sign in to comment.