mirror of
https://github.com/rwinkhart/convertroman.git
synced 2026-09-01 14:47:15 -04:00
added examples
This commit is contained in:
@@ -1 +1,21 @@
|
||||
# Go Roman Numerals
|
||||
|
||||
Convert to and from roman numerals in Go.
|
||||
|
||||
```go
|
||||
func ExampleToInt() {
|
||||
integer, err := ToInt("IV")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(integer == 4)
|
||||
}
|
||||
|
||||
func ExampleFromInt() {
|
||||
roman, err := FromInt(4)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(roman == "IV")
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user