Skip to content

Commit 0c54386

Browse files
committed
feat: added an example
1 parent 2bd3647 commit 0c54386

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

examples/examples.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
// Package examples provides a collection of example functions
2-
package examples
1+
// Package main provides examples for the safe conversion package.
2+
package main
33

4-
// TODO - Add example functions that demonstrate the usage of the safe conversion package
4+
import (
5+
"log"
6+
7+
safeconversion "github.com/bsv-blockchain/go-safe-conversion"
8+
)
9+
10+
// main function demonstrates the usage of safe conversion functions.
11+
func main() {
12+
13+
// Example of converting int32 to uint32 safely
14+
val, err := safeconversion.Int32ToUint32(42)
15+
if err != nil {
16+
log.Fatal(err)
17+
}
18+
log.Printf("Converted value: %d", val)
19+
}

0 commit comments

Comments
 (0)