All The Ways to Get The Ternary Operator
This package provides multiple implementations of ternary operations in Go.
result := ternary.Functional(condition, trueValue, falseValue)result := ternary.If(condition)(trueValue)(falseValue)Convert ternary-like expressions to if statements:
go run cmd/convert/main.go -file input.goRun the tests:
go test ./...