Repository navigation
Release Notes for ternary Package v1.0.0
We are pleased to announce the release of the ternary package version 1.0.0. This package introduces a flexible and concise way to write ternary operations in Go, supporting both strict and lazy evaluations.
Features
- Ternary Operations: Implement simple ternary operations with the
Opfunction. - Lazy Evaluation: Evaluate ternary conditions lazily with the
LazyOpfunction, optimizing performance. - Fluent API: Use chained methods (
If,Then,Else,LThen,LElse) to build complex ternary expressions. - Support for Nested Ternary Expressions: Easily nest ternary operations for more complex conditions.
Examples
Basic ternary operation:
result := ternary.Op(true, "yes", "no") // result will be "yes"Lazy evaluation:
result := ternary.LazyOp[int](true, func() int { return 10 }, func() int { return 20 }) // result will be 10Nested ternary operations:
result := ternary.If[string](false).Then("foo").Else(ternary.If[string](true).Then("bar").Else("baz")) // result will be "bar"Installation
To install the ternary package, use the following command:
go get github.com/ForAeons/ternaryDocumentation
For detailed documentation and examples, please visit pkg.go.dev.
Support and Contribution
For bugs, feature requests, or contributions, please open an issue on our GitHub repository.
Thank You
We would like to thank all users for their support and feedback. We look forward to continuing to improve and expand the ternary package.