Skip to content

Commit 558a6f2

Browse files
committed
Added usage example
1 parent 0c7e87c commit 558a6f2

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

docs/source/usage.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
Usage
33
=====
44

5-
Describe here how to use the library with some general use examples.
5+
To use the parser just import it:
66

7-
Any detailed topic should go into it's own section.
7+
>>> from dice_notation.parser import DiceParser
8+
9+
And then parse a dice notation expression:
10+
11+
>>> parser = DiceParser()
12+
>>> dice = parser.parse('1d6+2')
13+
14+
The result can be accessed just by calling the 'roll' method as many times as
15+
needed, which will generate a new random value each time it is called.
16+
17+
>>> print(dice.roll())
18+
>>> print(dice.roll())

0 commit comments

Comments
 (0)