From fc6dbc7d0db25dc62c8c9a52e091543873ece685 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 27 Oct 2024 00:00:18 -0400 Subject: [PATCH] Improve README example --- README.md | 12 +++++++++++- convertroman_test.go | 9 --------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ba39bb4..b147307 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,20 @@ import ( ) func main() { - roman := FromInt(4) + var roman string + + // lowercase + roman = rom.FromInt(4) if roman == "OOB" { panic("Input integer is out of bounds (greater than 3,999,999)") } fmt.Println(roman == "iv") // True + + // capital (slightly slower) + roman = rom.FromIntCapital(4) + if roman == "OOB" { + panic("Input integer is out of bounds (greater than 3,999,999)") + } + fmt.Println(roman == "IV") // True } ``` diff --git a/convertroman_test.go b/convertroman_test.go index d99a2ad..46bb23f 100644 --- a/convertroman_test.go +++ b/convertroman_test.go @@ -1,7 +1,6 @@ package convertroman import ( - "fmt" "testing" ) @@ -49,11 +48,3 @@ func BenchmarkFromInt(b *testing.B) { _ = FromInt(3999) } } - -func ExampleFromInt() { - roman := FromInt(4) - if roman == "OOB" { - panic("Input integer is out of bounds (greater than 3,999,999)") - } - fmt.Println(roman == "iv") // True -}