Or / Tr
Or is a helper that returns the first non-empty value from the provided list.
Usage:
go
// Acts like "||" in other languages
val := logic.Or("", "default") // "default"
val := logic.Or(0, 0, 1, 2) // 1
Tr acts like a ternary operator in other languages. It returns one of two values based on the condition.
Usage:
go
// Acts like "condition ? trueValue : falseValue" in other languages
val := logic.Tr(false, "asd", "qwe") // "qwe"
val := logic.Tr(true, "asd", "qwe") // "asd"