feat: add Ternary

This commit is contained in:
dudaodong committed 2024-11-08 14:20:35 +08:00
1 parent 08f14d2b08
commit de877e5278
5 files changed
+90 -10

No files matched your search

+3 -3
View File
@@ -148,13 +148,13 @@ func ExampleNand() {
// false
}
func ExampleTernaryOperator() {
func ExampleTernary() {
conditionTrue := 2 > 1
result1 := TernaryOperator(conditionTrue, 0, 1)
result1 := Ternary(conditionTrue, 0, 1)
fmt.Println(result1)
conditionFalse := 2 > 3
result2 := TernaryOperator(conditionFalse, 0, 1)
result2 := Ternary(conditionFalse, 0, 1)
fmt.Println(result2)
// Output: