Skip to content

WillKirkmanM/Ternary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ternary

PWA Shields

All The Ways to Get The Ternary Operator

This package provides multiple implementations of ternary operations in Go.

Usage

Functional Approach

result := ternary.Functional(condition, trueValue, falseValue)

Builder Pattern

result := ternary.If(condition)(trueValue)(falseValue)

CLI Tool

Convert ternary-like expressions to if statements:

go run cmd/convert/main.go -file input.go

Testing

Run the tests:

go test ./...

About

All The Ways to Get The Ternary Operator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages